You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by vijay talreja <vi...@hotmail.com> on 2002/04/05 10:56:26 UTC

How can i log to more than one file using categories?

Hi

I am using the following configuration to write to a debug.log file and 
error.log file:

log4j.rootCategory = DEBUG, A1,A2
log4j.appender.A1=org.apache.log4j.FileAppender
log4j.appender.A1.File=/usr/WebSphere/app/im-r1/logs/ImDebugLog.log
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} -- 
[%-5p]: %m\n
log4j.appender.A1.Append=true
log4j.appender.A1.Threshold=DEBUG
log4j.additivity.com=false

log4j.appender.A2=org.apache.log4j.FileAppender
log4j.appender.A2.File=/usr/WebSphere/app/im-r1/logs/ImErrorLog.log
log4j.appender.A2.layout=org.apache.log4j.PatternLayout
log4j.appender.A2.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} -- 
[%-5p]: %m\n
log4j.appender.A2.Append=true
log4j.appender.A2.Threshold=ERROR
log4j.additivity.com=false

The above configuration is in a default.lcf file. And with the above things 
work just fine. But, I have a need to write the logging of a particular 
timer thread to a different log file. I tried adding the below to the 
default.lcf file but it doesnt writes to a different(timer.log) file but to 
the same one(debug.log) :

log4j.category.Timer = DEBUG, A1,A2
log4j.appender.A1=org.apache.log4j.FileAppender
log4j.appender.A1.File=/usr/WebSphere/app/im-r1/logs/Timer.log
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} -- 
[%-5p]: %m\n
log4j.appender.A1.Append=truelog4j.appender.A1.Threshold=DEBUG
log4j.additivity.Timer=false

Can someone tell me what is the mistake i am doing and what should i do to 
overcome this problem.

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>