Debugging Log4J: where are my log messages going?

If you’re looking for interesting reading, this is not it.

Today the question emerged: where are this test’s log messages going?

Sticking a debug point somewhere and doing Logger.getLogger(“blah”), then digging into the resulting Logger object, revealed the answer.

The Logger object had a parent member (a RootLogger), which had a member aai (AppenderAttachableImpl), which had an appenderList, which contained the appender, which contained the filename.

From that, we were able to figure out which log4j.properties file it was using, and remove the errant one from the classpath.