logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Curt Arnold <carn...@apache.org>
Subject Re: locating my log4j.properties file
Date Sat, 20 Nov 2010 05:24:27 GMT

On Nov 19, 2010, at 12:10 PM, Don Raikes wrote:

> Hello,
> Ok so now I just need a working example of a log4j.properties file.
> My desire is to have a console logger with level debug and a file appender with log level
= warn.
> I have been away from this for a while, but now need to quickly do some logging for a
project I am working on, and don't have a lot of time for tinkering around with properties
> Any help would be greatly appreciated.

Look at the tests/input directory for all the property files used in the unit tests.  All
of them would be a working property file.

In your case, you need to attach both appenders to the root, set the level of the root to
debug and set a threshold of warn on the file appender.  Here is an untested example:

log4j.rootLogger=DEBUG, FileAppender, ConsoleAppender
log4j.appender.FileAppender.layout.ConversionPattern=%-5p - %m%n
log4j.appender.ConsoleAppender.layout.ConversionPattern=%-5p - %m%n

To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

View raw message