You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by electroteque <sp...@electroteque.org> on 2006/03/17 01:42:01 UTC

Logging to particular levels + buffering smtpappender

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.


Re: Logging to particular levels + buffering smtpappender

Posted by electroteque <sp...@electroteque.org>.
im taking it from the example though ?

> <evaluator type="log4net.Core.LevelEvaluator">
> 				<threshold value="ERROR"/>
> 			</evaluator>

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 ?

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 <sp...@electroteque.org> 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>
>>
>


Re: Logging to particular levels + buffering smtpappender

Posted by Ron Grabowski <ro...@yahoo.com>.
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 <sp...@electroteque.org> 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>
> 


Re: Logging to particular levels + buffering smtpappender

Posted by electroteque <sp...@electroteque.org>.
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>