Comments (3)
We are seeing this too with many processes writing to the same log file. There is certainly a race condition between checking if its time to roll and opening the next file. When the second process re-opens the same file in "w" mode you get lots of craziness because, unlike append mode, "w" does not seek to the end of the file for you when writing. That means the processes will be battling it out and overwriting the middle of the file.
from log4r.
I'll note that simply changing "w" to "a" brought up another issue -- we got occasional errors where log4r was looking for a log file that didn't exist and raising an error, on the line @start_time = File.ctime(@filename)
. It only happens once a week or so for us so I haven't had time to debug it further.
from log4r.
We've run into this issue in production as well; the cause of this seem to be multiple unicorn worker using the same RollingFileOutputter.
Every process tracks the log size itself (https://github.com/colbygk/log4r/blob/master/lib/log4r/outputter/rollingfileoutputter.rb#L128) and never actually checks the file size. This means that workers decide to roll over to the next file independently and when rolling over they can just overwrite existing file generated by another worker (https://github.com/colbygk/log4r/blob/master/lib/log4r/outputter/rollingfileoutputter.rb#L198).
from log4r.
Related Issues (20)
- Intermittent error: NoMethodError: undefined method `is_root?' for nil:NilClass
- Test fails for 1.1.10 HOT 1
- Improved documentation HOT 3
- Include license file in the .gem release HOT 2
- LEVEL can't be passed as parameter to yaml cfg file HOT 1
- undefined method `formatter' for Log4r::Logger in Rails? HOT 5
- Adding child logger before initial parent results in unexpected level HOT 1
- Please handle log dirname consistently
- Feature Request: logger methods to always return nil HOT 1
- Can't run examples in 1.1.11
- warning: `+' after local variable or literal is interpreted as binary operator HOT 10
- Prepend not working? HOT 1
- License inconsistencies
- Implement <<
- Please create a new release and upload it HOT 1
- yamlconfigurator issue in Ruby 2.5.0
- log4r-color merge? HOT 2
- make a new release? HOT 3
- Can not be used under Rails 6.
- Is Log4r impacted by latest Log4j security vulnerability? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from log4r.