Log4J Multiple Log Files
Is is possible to be able to log messages to multiple log files based upon the severity of a message? For instance could I log Errors to a Errors.log and Warnings to a Warnings.log? Thanks for the help, Marty - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Log4J Multiple Log Files
Something like this should work. Notice the filter elements (copied from some earlier post on the user list) appender name=FILE class=org.apache.log4j.FileAppender param name=File value=debug_and_info.log/ param name=DatePattern value=_MMdd_HHmm/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%p - %m%n / /layout filter class=org.apache.log4j.varia.LevelRangeFilter param name=LevelMin value=DEBUG/ param name=LevelMax value=INFO/ /filter /appender appender name=STDOUT class=be.belgacom.mobile.log4j.ConsoleAppender layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%p - %m%n / /layout filter class=org.apache.log4j.varia.LevelMatchFilter param name=LevelToMatch value=ERROR/ /filter /appender root level value=debug/ appender-ref ref=FILE/ appender-ref ref=STDOUT/ /root For your case, just have a couple different file appenders with the appropriate filtering you want on each and add all those appenders to you root logger. Jake At 07:46 AM 12/10/2003 -0600, you wrote: Is is possible to be able to log messages to multiple log files based upon the severity of a message? For instance could I log Errors to a Errors.log and Warnings to a Warnings.log? Thanks for the help, Marty - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Log4J Multiple Log Files
Jacob, thanks for the info. It is exactly what I am looking for. -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 10, 2003 8:00 AM To: Log4J Users List Subject: Re: Log4J Multiple Log Files Something like this should work. Notice the filter elements (copied from some earlier post on the user list) appender name=FILE class=org.apache.log4j.FileAppender param name=File value=debug_and_info.log/ param name=DatePattern value=_MMdd_HHmm/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%p - %m%n / /layout filter class=org.apache.log4j.varia.LevelRangeFilter param name=LevelMin value=DEBUG/ param name=LevelMax value=INFO/ /filter /appender appender name=STDOUT class=be.belgacom.mobile.log4j.ConsoleAppender layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%p - %m%n / /layout filter class=org.apache.log4j.varia.LevelMatchFilter param name=LevelToMatch value=ERROR/ /filter /appender root level value=debug/ appender-ref ref=FILE/ appender-ref ref=STDOUT/ /root For your case, just have a couple different file appenders with the appropriate filtering you want on each and add all those appenders to you root logger. Jake At 07:46 AM 12/10/2003 -0600, you wrote: Is is possible to be able to log messages to multiple log files based upon the severity of a message? For instance could I log Errors to a Errors.log and Warnings to a Warnings.log? Thanks for the help, Marty - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]