Ever seen duplicate lines in your log4j output? Maybe something like this:
2010-06-28 21:56:11,743 [main] INFO org.quartz.impl.StdSchedulerFactory - Quartz scheduler version: 1.8.1 2010-06-28 21:56:11,743 [main] INFO org.quartz.impl.StdSchedulerFactory - Quartz scheduler version: 1.8.1 2010-06-28 21:56:11,750 [main] INFO org.quartz.core.QuartzScheduler - Scheduler MyScheduler_$_1 started. 2010-06-28 21:56:11,750 [main] INFO org.quartz.core.QuartzScheduler - Scheduler MyScheduler_$_1 started.
Well, the obvious cause is probably duplicate loggers your log4j configuration:
log4j.rootLogger=INFO, DefaultConsoleAppender log4j.logger.org.quartz=DEBUG, DefaultConsoleAppender
As the properties are inherited from the root logger, this is telling log4j that all quartz
-classes should send their log to the DefaultConsoleAppender
(which the root logger is doing anyway). So we simply have to remove the appender from the second logger definition:
log4j.rootLogger=INFO, DefaultConsoleAppender log4j.logger.org.quartz=DEBUG
So watch your inherited log levels and appenders in your log4j configuration!
If anyone knows, why these duplicate lines appear from time to time in heavily multi-threaded environments (although log4j claims to be thread-safe) despite correct property files, please drop me a mail or leave a comment.