logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicko Cadell" <ni...@neoworks.com>
Subject RE: Threshold doesn't work?
Date Tue, 28 Feb 2006 18:00:38 GMT
You are trying to set an <evaluator> which is a different thing to a plain <threshold>
(the differences are subtle). The FileAppender/RollingFileAppender does not support the <evaluator>
at all.

Change your config to specify the <threshold> outside the <evaluator>, and then
remove the <evaluator> tags completely.

If you need to understand the <evaluator> read the remarks section of the BufferingAppenderSkeleton:
http://logging.apache.org/log4net/release/sdk/log4net.Appender.BufferingAppenderSkeleton.html

Cheers,
Nicko

> -----Original Message-----
> From: Jose Antonio Cortijo Solera [mailto:joseacs@tempe.es] 
> Sent: 14 February 2006 10:09
> To: log4net-user@logging.apache.org
> Subject: Threshold doesn't work?
> 
> As I read in the FAQ I used the treshold tag to separate to 
> output of each aprender depending of a level,
> 
>  
> 
> This is my configuration file
> 
>       <configSections>
> 
>             <section name="log4net" 
> type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
> 
>       </configSections>
> 
>       <log4net>
> 
>             <appender name="SmtpAppender" 
> type="log4net.Appender.SmtpAppender">
> 
>                   <to value="joseacs@tempe.es" />
> 
>                   <from value="webmaster@tempe.es" />
> 
>                   <subject value="TiendasOnLine - Logging" />
> 
>                   <smtpHost value="10.13.1.2" />
> 
>                   <bufferSize value="32" />
> 
>                   <lossy value="true" />
> 
>                   <evaluator type="log4net.Core.LevelEvaluator">
> 
>                         <threshold value="ERROR"/>
> 
>                   </evaluator>
> 
>                   <layout type="log4net.Layout.PatternLayout">
> 
>                         <conversionPattern 
> value="%newline%date [%thread] %-5level %logger 
> [%property{NDC}] - %message%newline%newline%newline" />
> 
>                   </layout>
> 
>             </appender>
> 
>             <appender name="RollingFileAppender" 
> type="log4net.Appender.RollingFileAppender" >
> 
>                   <param name="File" value="log\\TiendasOnLine.log" />
> 
>                   <param name="AppendToFile" value="true" />
> 
>                   <param name="MaxSizeRollBackups" value="30" />
> 
>                   <param name="MaximumFileSize" value="20000" />
> 
>                   <param name="RollingStyle" value="Size" />
> 
>                   <param name="StaticLogFileName" value="true" />
> 
>                   <evaluator type="log4net.spi.LevelEvaluator">
> 
>                         <threshold value="DEBUG" />
> 
>                   </evaluator>
> 
>                   <layout type="log4net.Layout.PatternLayout">
> 
>                         <param name="ConversionPattern" 
> value="%d %-5p - %m%n " />
> 
>                   </layout>
> 
>             </appender>       
> 
>             <appender name="TraceAppender" 
> type="log4net.Appender.TraceAppender">
> 
>                   <layout type="log4net.Layout.PatternLayout">
> 
>                         <conversionPattern value="%date 
> [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
> 
>                   </layout>
> 
>             </appender>
> 
>             <root>
> 
>                   <level value="DEBUG" />
> 
>                   <appender-ref ref="SmtpAppender" />
> 
>                   <appender-ref ref="RollingFileAppender" />
> 
>             </root>
> 
>  
> 
>       </log4net>
> 
>  
> 
> And in my asp.net code:
> 
> . . .
> 
>       public class blanco : System.Web.UI.Page
> 
>       {
> 
>       
> 
>             private static readonly ILog log = 
> LogManager.GetLogger(typeof(blanco));
> 
>  
> 
>  
> 
>             private void Page_Load(object sender, System.EventArgs e)
> 
>             {
> 
>                   BasicConfigurator.Configure();
> 
>                   // Obtenemos las secciones abiertas para la 
> cadena actual
> 
>                   log.Error("ERRRRORRRR");
> 
>                   log.Debug("DEBUGGGGGG");
> 
> . . . . . 
> 
>  
> 
> But the all the log is written in both appenders, in the file 
> and by email....
> 
>  
> 
> Could someone tell me what I am doing wrong?
> 
>  
> 
> Thanks in advance.
> 
> Jose Antonio Cortijo Solera
> 
> Dpto. de Informática
> 
> INDITEX TEMPE
> 
> mailto:joseacs@tempe.es <mailto:joseacs@tempe.es> 
> 
> Tlfno. 966657500 Ext. 40969
> 
>  
> 
> 

Mime
View raw message