> -----Original Message-----
> From: electroteque [mailto:[EMAIL PROTECTED]
> Sent: 17 March 2006 05:09
> To: Log4NET User
> Subject: Re: Logging to particular levels + buffering smtpappender
>
> im taking it from the example though ?
>
> > <evaluator type="log4net.Core.LevelEvaluator">
> > <threshold value="ERROR"/>
> > </evaluator>
If you just want the smtp appender to log errors then use:
<appender name="SmtpAppender" type="log4net.Appender.SmtpAppender">
<threshold value="ERROR"/>
<subject value="Errors with WMSLogParser" />
<to value="" />
<from value="" />
<smtpHost value="" />
<authentication value="basic"/>
<username value=""/>
<password value=""/>
<bufferSize value="512" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern
value="%message%newline" />
</layout>
</appender>
This will buffer 512 errors before sending the email. The email will be
sent when the app exits regardless of the number of errors logged.
> Is there anyway for the filelog to only log info , warn and
> error levels and the debug level will be just for debugging
> in the console ?
If you want to log INFO and above via the file appender then set the
<threshold> on the file appender:
<appender name="fileappender" type="log4net.Appender.FileAppender">
<threshold value="INFO" />
...
<root>
<appender-ref name="fileappender" />
<appender-ref name="consoleappender" />
</root>
All levels will be sent to the console appender. If you only want to see
DEBUG output on the console, then you need to specify a level filter on
the console appender:
<appender name="consoleappender"
type="log4net.Appender.ConsoleAppender">
<filter type="log4net.Filter.LevelMatchFilter">
<levelToMatch value="DEBUG" />
</filter>
...
Cheers,
Nicko
>
> On 17/03/2006, at 4:01 PM, Ron Grabowski wrote:
>
> > Try adding a threshold node to the appender node:
> >
> > <appender name="SmtpAppender" type="log4net.Appender.SmtpAppender">
> > <threshold value="INFO"/>
> > <subject value="Errors with WMSLogParser" />
> > <to value="" />
> > <from value="" />
> > <smtpHost value="" />
> > <authentication value="basic"/>
> > <username value=""/>
> > <password value=""/>
> > <bufferSize value="512" />
> > <layout type="log4net.Layout.PatternLayout">
> > <conversionPattern
> > value="%message%newline" />
> > </layout>
> > </appender>
> >
> > --- electroteque <[EMAIL PROTECTED]> wrote:
> >
> >>
> >> On 17/03/2006, at 11:42 AM, electroteque wrote:
> >>
> >>> Hi there, I was wondering if there was a possibility of being able
> >> to
> >>> log to file all levels except the debug level which i want the
> >> console
> >>> only to display ? Also how is it possible to buffer all the logs
> >> going
> >>> to smtp appender and send it once the program has finished or
> >> exiting
> >>> with an error ? I only one to recieve one email not many really.
> >> Let
> >>> me know.
> >>>
> >>>
> >> Here is my smtp config, the level is being ignored its sending all
> >> log levels !
> >>
> >> <appender name="SmtpAppender" type="log4net.Appender.SmtpAppender">
> >> <subject value="Errors with WMSLogParser" />
> >> <to value="" />
> >> <from value="" />
> >> <smtpHost value="" />
> >> <authentication value="basic"/>
> >> <username value=""/>
> >> <password value=""/>
> >> <bufferSize value="512" />
> >> <lossy value="false" />
> >> <evaluator type="log4net.Core.LevelEvaluator">
> >> <threshold value="ERROR"/>
> >> </evaluator>
> >> <layout type="log4net.Layout.PatternLayout">
> >> <conversionPattern
> value="%newline%d{dd MMM yyyy HH:mm:ss}
> >> [%thread] %-5level %logger - %message%newline%newline%newline" />
> >> </layout>
> >> </appender>
> >>
> >
>
>
>