File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Open Source Projects and the fly likes Strange behaviour 'DailyRollingFileAppender', two process one log4j configuration file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Strange behaviour Watch "Strange behaviour New topic
Author

Strange behaviour 'DailyRollingFileAppender', two process one log4j configuration file

Daniel Cote
Greenhorn

Joined: May 20, 2004
Posts: 9
Hi everydoby.

I'm having a strange behaviour with a log4j configuration. I hva two different process running from two different virtual machines. Both of then read their log4j configuration from the same configuration file:

----------------------------------------------------------------------------------------------
log4j.rootCategory=DEBUG
log4j.logger.FileChecker=DEBUG,FileChecker
log4j.logger.AlertChecker=DEBUG,AlertChecker

#
# FileChecker is a DailyRollingFileAppender
#
log4j.appender.FileChecker=org.apache.log4j.DailyRollingFileAppender
log4j.appender.FileChecker.file=./log/mylogRecibir.log
log4j.appender.FileChecker.datePattern='.'yyyy-MM-dd
log4j.appender.FileChecker.append=true
log4j.appender.FileChecker.layout=org.apache.log4j.PatternLayout
log4j.appender.FileChecker.layout.ConversionPattern=[%c] %-5p %d{ISO8601} - %m%n
#
# AlertChecker is a DailyRollingFileAppender
#
log4j.appender.AlertChecker=org.apache.log4j.DailyRollingFileAppender
log4j.appender.AlertChecker.file=./log/mylogSend.log
log4j.appender.AlertChecker.datePattern='.'yyyy-MM-dd
log4j.appender.AlertChecker.append=true
log4j.appender.AlertChecker.layout=org.apache.log4j.PatternLayout
log4j.appender.AlertChecker.layout.ConversionPattern=[%c] %-5p %d{ISO8601} - %m%n
----------------------------------------------------------------------------------------------

(in both of the process java code I do:
private static Logger logger = Logger.getLogger("AlertChecker");
.....
PropertyConfigurator.configure(IPegasoProperties.IPEGASO_PROPERTIES_FILE); //the logj4j configuration file
)

It happens that when day changes old logging files are not renamed properly; instead they are overwritten.

Also, when log files are from an older day (process are stopped); the first process I start roll the log file properly, but the second overwrite his log (don't do the roll).

I'm tested new versions and log4j and the problem is the same.

Could anybody help me?
 
Consider Paul's rocket mass heater.
 
subject: Strange behaviour 'DailyRollingFileAppender', two process one log4j configuration file
 
Similar Threads
log4j DailyRollingFileAppender
log4j - dailyrollingfileappender
Dukes Bank and log4j error
log4j: Logger does not log
Why do I get "log4j:WARN No appenders could be found for logger" message on server st