is there a standard configuration regarding logging with log4j in JUnit using Eclipse? When I create a new JUnit-Test testing a class which uses a Logger I don't have to change the Run Configuration to enable l开发者_如何学JAVAogging. Magically the Junit Test is redirecting the log messages to standard out.
But in my case only messages with importance INFO get printed. Does anybody know how to change this behaviour and where to find the configuration of the JUnit logger.
I could change the Run configurations for every JUnit test but I am more interested in the default behaviour and the logic behind.
This has nothing to do with JUnit, it's just log4j behavior. Sounds like there is a log4j.xml
or log4j.properties
somewhere on your classpath that is getting picked up (as I believe log4j will log nothing by default, and instead print warnings to standard error about not being configured correctly) - add -Dlog4j.debug
to your system VM args to have log4j print out some diagnostic information about where it is loading the configuration from.
精彩评论