[prev in list] [next in list] [prev in thread] [next in thread] 

List:       log4net-user
Subject:    Re: Log not logging in custom filter
From:       "stefan.moser" <stefan.moser () wolverton ! ca>
Date:       2009-05-19 22:13:42
Message-ID: 23625391.post () talk ! nabble ! com
[Download RAW message or body]


Thanks Loren, that's exactly what I'm looking for.

Cheers,
Stefan



Loren Keagle wrote:
> 
> stefan.moser wrote:
> > I'm writing a custom filter (inherits from FilterSkeleton) and I want to
> > log
> > errors inside the filter.  The problem is that any log events created
> > inside
> > the filter is not getting logged.  Is there a special restriction that
> > log
> > events cannot be created this far down inside the loggin pipeline?
> > 
> > public override FilterDecision Decide(LoggingEvent loggingEvent)
> > {
> > // Do the interesting stuff
> > 
> > // In some exceptional case, log an error
> > LogManager.GetLogger("TheLogger").Error("log message", exception);
> > }
> > 
> > Any reason why this code wouldn't work?
> > 
> 
> Inside of the log4net framework, there is an internal logger called 
> LogLog.  It's used throughout the appender framework, but I imagine 
> there's no problem using it in a filter.
> 
> Just call:
> 
> LogLog.Error("log message");
> 
> 
> ~Loren
> 
> 
> 

-- 
View this message in context: \
http://www.nabble.com/Log-not-logging-in-custom-filter-tp23624032p23625391.html Sent \
from the Log4net - Users mailing list archive at Nabble.com.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic