Re: How to filter on logger name.
The only bit i was missing was the threshold on the appenders. log4j.rootLogger=ERROR, R log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=${catalina.home}/logs/root.log log4j.appender.R.MaxFileSize=128MB log4j.appender.R.MaxBackupIndex=5 log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n log4j.appender.R.threshold=ERROR log4j.logger.org.springframework=DEBUG, spring log4j.logger.com.another.package=DEBUG, spring log4j.appender.spring=org.apache.log4j.RollingFileAppender log4j.appender.spring.File=${catalina.home}/logs/spring.log log4j.appender.spring.MaxFileSize=128MB log4j.appender.spring.MaxBackupIndex=5 log4j.appender.spring.layout=org.apache.log4j.PatternLayout log4j.appender.spring.layout.ConversionPattern=%p %t %c - %m%n log4j.appender.spring.threshold=ERROR On 8/2/07, Curt Arnold [EMAIL PROTECTED] wrote: On Aug 1, 2007, at 5:16 PM, Walter Holladay wrote: Hi, I work on a large project that has lots of logging information being written to the log file. I want to narrow what logging data I see to only those messages logged by my team mates. The way I would like to do this is by having a filter that will only pass through messages logged from a given logger, or loggers. All of the loggers at my company are created using the class that is doing the logging. For example private Logger logger = Logger.getLogger(getClass()). Therefore, I would like to be able to specify the class or the package that the logger belongs to, and only have those messages go to my log file. I would think this is a fairly common thing to do. However, I cannot find a filter that does this. Is there some way to accomplish this, short of writing my own filter? Thanks, Walter It is by far more common and efficient to use thresholds than filters for the scenario you described. Thresholds are used to discard logging requests prior to the creation of a LoggingEvent, filters are only applied after the LoggingEvent is created. You could set the threshold on the root logger to something high (ERROR, FATAL or OFF) and the threshold to logger corresponding to your package or class of interest to something lower like DEBUG or INFO. All of that should be covered http://logging.apache.org/log4j/ docs/manual.html. If you really did need to use a filter, there are two different classes (ExpressionFilter and LoggerMatchFilter) in the log4j extras companion (not yet released, but release candidates are available) that can filter on logger name. - 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]
How to filter on logger name.
Hi, I work on a large project that has lots of logging information being written to the log file. I want to narrow what logging data I see to only those messages logged by my team mates. The way I would like to do this is by having a filter that will only pass through messages logged from a given logger, or loggers. All of the loggers at my company are created using the class that is doing the logging. For example private Logger logger = Logger.getLogger(getClass()). Therefore, I would like to be able to specify the class or the package that the logger belongs to, and only have those messages go to my log file. I would think this is a fairly common thing to do. However, I cannot find a filter that does this. Is there some way to accomplish this, short of writing my own filter? Thanks, Walter
Re: How to filter on logger name.
Hi, I have setup the same kind of thing at work but don't have access to the files at the moment. From memory the following will log all error and above messages to root.log. And all messages from the org.springframework and com.another.package packages go to spring.log. log4j.rootLogger=ERROR, R log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=${catalina.home}/logs/root.log log4j.appender.R.MaxFileSize=128MB log4j.appender.R.MaxBackupIndex=5 log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n log4j.logger.org.springframework=DEBUG, spring log4j.logger.com.another.package=DEBUG, spring log4j.appender.spring=org.apache.log4j.RollingFileAppender log4j.appender.spring.File=${catalina.home}/logs/spring.log log4j.appender.spring.MaxFileSize=128MB log4j.appender.spring.MaxBackupIndex=5 log4j.appender.spring.layout=org.apache.log4j.PatternLayout log4j.appender.spring.layout.ConversionPattern=%p %t %c - %m%n So you just setup a logger and appender for each class/package that you want to separate out. If someone else hasn't enlightened you I'll send you some config tomorrow. Regards Ben On 8/1/07, Walter Holladay [EMAIL PROTECTED] wrote: Hi, I work on a large project that has lots of logging information being written to the log file. I want to narrow what logging data I see to only those messages logged by my team mates. The way I would like to do this is by having a filter that will only pass through messages logged from a given logger, or loggers. All of the loggers at my company are created using the class that is doing the logging. For example private Logger logger = Logger.getLogger(getClass()). Therefore, I would like to be able to specify the class or the package that the logger belongs to, and only have those messages go to my log file. I would think this is a fairly common thing to do. However, I cannot find a filter that does this. Is there some way to accomplish this, short of writing my own filter? Thanks, Walter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to filter on logger name.
Sending logs from only certain loggers to an appender is one of the most common ways to use log4j. On 8/1/07, Walter Holladay [EMAIL PROTECTED] wrote: Hi, I work on a large project that has lots of logging information being written to the log file. I want to narrow what logging data I see to only those messages logged by my team mates. The way I would like to do this is by having a filter that will only pass through messages logged from a given logger, or loggers. All of the loggers at my company are created using the class that is doing the logging. For example private Logger logger = Logger.getLogger(getClass()). Therefore, I would like to be able to specify the class or the package that the logger belongs to, and only have those messages go to my log file. I would think this is a fairly common thing to do. However, I cannot find a filter that does this. Is there some way to accomplish this, short of writing my own filter? Thanks, Walter -- James Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to filter on logger name.
On Aug 1, 2007, at 5:16 PM, Walter Holladay wrote: Hi, I work on a large project that has lots of logging information being written to the log file. I want to narrow what logging data I see to only those messages logged by my team mates. The way I would like to do this is by having a filter that will only pass through messages logged from a given logger, or loggers. All of the loggers at my company are created using the class that is doing the logging. For example private Logger logger = Logger.getLogger(getClass()). Therefore, I would like to be able to specify the class or the package that the logger belongs to, and only have those messages go to my log file. I would think this is a fairly common thing to do. However, I cannot find a filter that does this. Is there some way to accomplish this, short of writing my own filter? Thanks, Walter It is by far more common and efficient to use thresholds than filters for the scenario you described. Thresholds are used to discard logging requests prior to the creation of a LoggingEvent, filters are only applied after the LoggingEvent is created. You could set the threshold on the root logger to something high (ERROR, FATAL or OFF) and the threshold to logger corresponding to your package or class of interest to something lower like DEBUG or INFO. All of that should be covered http://logging.apache.org/log4j/ docs/manual.html. If you really did need to use a filter, there are two different classes (ExpressionFilter and LoggerMatchFilter) in the log4j extras companion (not yet released, but release candidates are available) that can filter on logger name. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]