Hi,

I'm trying to log messages for separate categories to separate appenders
(and to no others), and I want to configure it statically and not
programmatically.

log4j.rootCategory=debug, main
log4j.appender.main=org.apache.log4j.ConsoleAppender
log4j.appender.main.layout=org.apache.log4j.PatternLayout

log4j.appender.test1=org.apache.log4j.FileAppender
log4j.appender.test1.File=c:\\temp\\test1.log
log4j.appender.test1.layout=org.apache.log4j.PatternLayout

... does not work. Test1 is never initialized.

log4j.rootCategory=debug, main, test1
log4j.appender.main=org.apache.log4j.ConsoleAppender
log4j.appender.main.layout=org.apache.log4j.PatternLayout

log4j.appender.test1=org.apache.log4j.FileAppender
log4j.appender.test1.File=c:\\temp\\test1.log
log4j.appender.test1.layout=org.apache.log4j.PatternLayout

Does not do what I want, since everything logged to root is appended to
test1, and I only want the Category 'test1' to log to the 'test1.log' file.

I can do it programmatically like this:

Category test1 = Category.getInstance( "test1" );
test1.addAppender( new FileAppender( new PatternLayout(),
"c:\\temp\\test1.log" ) );
test1.setAdditivity( false );

But this takes away the advantage of configuring all logging one place.

Any ideas?

Another thing; the documentation does not seem to have an exhaustive list of
all possible prefined properties. Or does it?

--

Thomas



*************************************************************************
Copyright ERA Technology Ltd. 2001. (www.era.co.uk). All rights reserved. 
Confidential. No liability whatsoever is accepted for any loss or damage 
suffered as a result of accessing this message or any attachments.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to