logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "vijay talreja" <vijaytalr...@hotmail.com>
Subject How can i log to more than one file using categories?
Date Thu, 01 Jan 1970 00:00:00 GMT
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:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>


Mime
View raw message