0

I use logger org.apache.commons.logging.Log.

File log4j.properties is:

log4j.rootCategory=INFO, S

log4j.appender.stdout=org.apache.log4j.ConsoleAppender

log4j.logger.org.springsource.sawt=DEBUG
log4j.logger.org.w3c.tidy=INFO
...................

When I use debug method of org.apache.commons.logging.Log it doesn't log anything.

How to change log4j.properties to enable logger log debug messages?

Volodymyr Levytskyi
  • 3,364
  • 9
  • 46
  • 83

1 Answers1

0

It is really simple.

If you want to log all debug,info,warn.error,fatal messages from logger you need to take name of logger provided at instantiation by method LogFactory.getLog(loggerName) and append it to log4j.logger`. Thus you get

log4j.logger.loggerName=DEBUG

But it's common that loggerName is String from getClass() method. Thus you can use package name to set logger's level for that package.

Volodymyr Levytskyi
  • 3,364
  • 9
  • 46
  • 83