I have a number of identical processes that are writing to a single log file using a Log4j DailyRollingFileAppender
. I am concerned that multiple processes may try and roll the file and that chaos will ensue. Does the implementation allow for this using with some kind of locking mechanism? - the Javadoc doesn't mention it.
views:
430answers:
2
+1
A:
it is not advisible to let multiple processes access the same log file. mayhem will occur
Salandur
2010-01-15 10:52:22
Thanks - I did check for dupes but didn't find that one.
teabot
2010-01-15 11:41:19
If you implement the writer, versus just using log4j again, you can add an extra feature. The receiver can queue the writes. If the queue becomes too large, you can dump data. This can be a great performance feature should your environment become IO bound (can happen with a lot of logging). It also allows you to move the logging component to another machine, which cuts down the vast amount of performance impact of logging.
Jim Rush
2010-01-15 12:01:59