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]

Reply via email to