I came across the need to disable logging (debug) for a specific package in Apache Log4j today whilst coding. It’s simple. All you need to do is precede the package name, e.g. net.beplacid, with log4j.logger and follow that with “=LEVEL”, where ‘level’ is one of TRACE, DEBUG, INFO, WARN, ERROR and FATAL – the standard Log4j logging levels. To demonstrate:
log4j.logger.net.beplacid=DEBUG
Would set the logging level to DEBUG for all registered loggers in classes net.beplacid. Similarly:
log4j.logger.net.beplacid=FATAL
Would disable all but FATAL logging calls.
Hope that helps someone, I couldn’t find an ‘easy fix’ page when searching…
2 Comments
thanks .. it seems to help me … :)
- Raj
it help me alot…
Post a Comment