logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Trond G. Ziarkowski" <trond.ziarkow...@gep-as.com>
Subject Logging to separate files with different levels
Date Fri, 29 Oct 2004 07:46:53 GMT
Hi all,

I'm all new to log4j and all help is appreciated.

I want to log everything from my app into file MyApp.log, but I also 
want _one_ of the classes to log with a different level to file 
MyClass.log. I have managed to do this, but output sent to file 
MyClass.log is also sent to MyApp.log. My intention was to send output 
from my class to MyClass.log only. Is this possible with log4j? If this 
is possible, all hints or links to docs on how to configure this is much 
appreciated

My log4j.properties looks something like this:

log4j.rootLogger=ERROR, A
log4j.appender.A=org.apache.log4j.DailyRollingFileAppender
log4j.appender.A.File=MyApp.log
log4j.appender.A.DatePattern='.'yyyy-MM-dd
log4j.appender.A.Append=true
log4j.appender.A.layout=org.apache.log4j.PatternLayout
log4j.appender.A.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %m%n

log4j.logger.com.mycomp.myapp.util.MyClass=DEBUG, B
log4j.appender.B=org.apache.log4j.DailyRollingFileAppender
log4j.appender.B.File=MyClass.log
log4j.appender.B.DatePattern='.'yyyy-MM-dd
log4j.appender.B.Append=true
log4j.appender.B.layout=org.apache.log4j.PatternLayout
log4j.appender.B.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %m%n


Thanks

Trond Ziarkowski

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


Mime
View raw message