logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Dougan" <kdou...@rim.net>
Subject log4j.properties - How to parse outpu to multiple files
Date Wed, 08 Oct 2003 19:08:39 GMT
Greetings log4j list!

I'd like my logging output to be sent to multiple files at once. However, I only want ERRORs
in the app-error.log file, DEBUG in the app-debug.log file, etc. As a potential compromise,
I would be OK if I was able to at least reduce the types of log messages as the severity increased.

Can anyone assist with my log4.properties file? I've included a copy below, but note that
this config sends all the logging output to all files.

In addition, is there a way to avoid all the duplication in this config file, so I just have
to change the name of the output file in each case, and inherit all the RollingFileAppender
settings as I define each file?

Thanks!

log4j.threshold=ALL
log4j.rootLogger=ALL, stdout, DebugAppender, InfoAppender, WarnAppender, ErrorAppender

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%c %d{ISO8601} -- %p -- %m%n

log4j.logger.DebugAppender.access=DEBUG
log4j.appender.DebugAppender=org.apache.log4j.RollingFileAppender
log4j.appender.DebugAppender.File=C:\\logs\\app-debug.log
log4j.appender.DebugAppender.MaxFileSize=500KB
log4j.appender.DebugAppender.MaxBackupIndex=10
log4j.appender.DebugAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.DebugAppender.layout.ConversionPattern=%c %d{ISO8601} -- %p -- %m%n

log4j.logger.InfoAppender.access=INFO
log4j.appender.InfoAppender=org.apache.log4j.RollingFileAppender
log4j.appender.InfoAppender.File=C:\\logs\\app-info.log
log4j.appender.InfoAppender.MaxFileSize=500KB
log4j.appender.InfoAppender.MaxBackupIndex=10
log4j.appender.InfoAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.InfoAppender.layout.ConversionPattern=%c %d{ISO8601} -- %p -- %m%n

log4j.logger.WarnAppender.access=WARN
log4j.appender.WarnAppender=org.apache.log4j.RollingFileAppender
log4j.appender.WarnAppender.File=C:\\logs\\app-warn.log
log4j.appender.WarnAppender.MaxFileSize=500KB
log4j.appender.WarnAppender.MaxBackupIndex=10
log4j.appender.WarnAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.WarnAppender.layout.ConversionPattern=%c %d{ISO8601} -- %p -- %m%n

log4j.logger.ErrorAppender.access=ERROR
log4j.appender.ErrorAppender=org.apache.log4j.RollingFileAppender
log4j.appender.ErrorAppender.File=C:\\logs\\app-error.log
log4j.appender.ErrorAppender.MaxFileSize=500KB
log4j.appender.ErrorAppender.MaxBackupIndex=10
log4j.appender.ErrorAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.ErrorAppender.layout.ConversionPattern=%c %d{ISO8601} -- %p -- %m%n

Kevin Dougan - kdougan@rim.net
Systems Architect
IT - Business Systems
Research In Motion - www.rim.com
BlackBerry Cell: 519-572-9417
Desk Phone: 519-888-7465  ext. 2451

This transmission may contain confidential or privileged material. Any use of this information
by anyone other than the intended recipient is prohibited. If you have received this transmission
in error, please immediately reply to the sender and delete this information from your system.
Use, dissemination, distribution, or reproduction of this transmission by unintended recipients
is not authorized and may be unlawful.



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


Mime
View raw message