|
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="[EMAIL PROTECTED]" /> <from value="[EMAIL PROTECTED]" /> <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 Tlfno. 966657500 Ext. 40969 |
- Threshold doesn't work? Jose Antonio Cortijo Solera
- RE: Threshold doesn't work? Nicko Cadell
