开发者

How to set my logger to show debug messages?

开发者 https://www.devze.com 2023-03-28 07:46 出处:网络
I\'m sure this is easy, but I\'m failing to find it. I have a org.apache.commons.logging.Log instance for logging, and I see that the source code of one of my dependencies has statements like:

I'm sure this is easy, but I'm failing to find it.

I have a org.apache.commons.logging.Log instance for logging, and I see that the source code of one of my dependencies has statements like:

if (logger.isDebugEnabled())
    logger.debug("Doing stuff.");

I would like to enable debugging, so that I could see these messages. I'm using Maven to build, and run tests. I don't particularly care whether the solution is a command-line argument, adding something to pom.xml, or using code to set the 开发者_运维技巧logger itself.


In your log4j.properties specify log4j.logger.com.yourpackage=debug. If you don't have a log4j.properties, get a default one (google it) and place it on the root of your classpath.

(commons-logging will delegate to log4j)


org.apache.commons.logging.Log is not a logging framework. It is an abstract interface which helps you to have any concrete logging implementation under it.
There is a good chance that you are using log4j underneath the org.apache.commons.logging.Log api . If that is the case then place a log4j.properties at the root of your classpath. If you already have one then you just need to change the log level as specified in the file . If you are using any other logger like jdk logger you need to find the logging configuration file for the same.

0

精彩评论

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