Dru,

As Kiran suggests you have to do this by setting the Threshold on an
appender rather than specifying multiple levels on a logger.

The appenders support threshold levels and also filter chains that allow
complex decisions to be made about whether or not an event should be
written out for that specific appender.

The logger level is designed to be simple, quick to evaluate and
inheritable.

Cheers,

Nicko

> -----Original Message-----
> From: Kiran Raja [mailto:[EMAIL PROTECTED] 
> Sent: 30 December 2004 16:11
> To: Log4NET User
> Subject: Re: logger question
> 
> Dru,
> 
> If you cannot do what Ron has suggested because you want to 
> use the same logger in the app to log through different 
> appenders each with a different threshold, then try this:
> 
> <logger name="MyObject">
>         <level value="INFO" />
>         <appender-ref ref="TableAppender" />
>         <appender-ref ref="EmailAppender" /> </logger>
> 
> <appender name="EmailAppender" type="log4net.Appender.SmtpAppender" />
>         <threshold value="WARN" />
>         ....
> </appender>
> 
> That will allow you to write to both appenders using the 
> MyObject logger. 
> But once the event is delegated to EmailAppender, the 
> threshold value takes over and writes only ones that are WARN 
> or above whereas TableAppender will write everything INFO or 
> above. The only thing is that the level value for the logger 
> should be the least common denominator.
> 
> I havent tested it before writing the mail.. :-) So give it a 
> shot.. Hope that helps.
> 
> Regards,
> Kiran Raja.
> x2406
> 
> 
> 
> 
> Ron Grabowski <[EMAIL PROTECTED]>
> 12/30/2004 11:02 AM
> Please respond to
> "Log4NET User" <[email protected]>
> 
> 
> To
> Log4NET User <[email protected]>
> cc
> 
> Subject
> Re: logger question
> 
> 
> 
> 
> 
> 
> Could you do something like this:
> 
> <logger name="MyObjectINFO">
>                  <level value="INFO" />
>                  <appender-ref ref="TableAppender" />
> </logger>
> <logger name="MyObjectWARN">
>                  <level value="WARN" />
>                  <appender-ref ref="EmailAppender" />
> </logger>
> 
> --- Dru Sellers <[EMAIL PROTECTED]> wrote:
> 
> > Can I do something like this? If not, how might I accomplish this?
> > 
> > <logger name="MyObject">
> >                <level value="INFO" />
> >                <appender-ref ref="TableAppender" />
> > 
> >                <level value="WARN" />
> >                <appender-ref ref="EmailAppender" />
> > </logger>
> > 
> > Dru
> > 
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.824 / Virus Database: 562 - Release Date: 12/28/2004
> > 
> > 
> > 
> > 
> 
> 
> 
> 
> 
> The information transmitted is intended only for the person 
> or entity to which it is addressed and may contain 
> CONFIDENTIAL material.  If you receive this 
> material/information in error, please contact the sender and 
> delete or destroy the material/information.
> 

Reply via email to