开发者

What is the JUnit default configuration for Logging with log4j and how to change it using eclipse?

开发者 https://www.devze.com 2023-02-25 11:25 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消