views:

132

answers:

1

In my application I'm using log4j and some 3rd party jars. One of those 3rd party jars is using Commons Logging. Now whenever I use classes from that 3rd party jar, somehow the log message is handled by two separate appenders. For example:

  • in my log4j.properties I have specified:

    • log4j.logger.myClass=DEBUG, serverFile, defaultSTDOUT, where serverFile is a org.apache.log4j.RollingFileAppender and defaultSTDOUT is org.apache.log4j.ConsoleAppender
  • in my code I do Logger logger = Logger.getLogger(myClass.class) and then I ue it like logger.debug("debug message")

  • in console I see

DEBUG [2009-10-14 16:08:34,415] - debug message

51215 [Thread-13] DEBUG myClass - debug message

The first line is mine and the second line is probably there because of that 3rd party jar. How can I ensure that only my log message are shown?

A: 

It seems that specifying log4j.additivity for my logger did the job.

kovica