log4net - how do I set DEBUG for my Console output, and INFO for my FileAppender?
- by Greg
Hi,
I haven't quite worked this one out yet - how do I set DEBUG for my Console output, and INFO for my FileAppender? That is, how would I change the configuration below so that I can get the ConsoleAppender pumping out all logging from DEBUG upwards? Note that both appenders need to cover all logging (i.e. I don't want to use a scoped logger element that changes the log level for just one logger name)
<log4net>
<root>
<level value="INFO" />
<appender-ref ref="LogFileAppender" />
<appender-ref ref="ConsoleAppender" />
</root>
<appender name="LogFileAppender" type="log4net.Appender.FileAppender" >
<param name="File" value="log-file.txt" />
<param name="AppendToFile" value="true" />
<layout type="log4net.Layout.PatternLayout">
<param name="Header" value="[Header]\r\n"/>
<param name="Footer" value="[Footer]\r\n"/>
<param name="ConversionPattern"
value="%d [%t] %-5p %c [%x] - %m%n"
/>
</layout>
<filter type="log4net.Filter.LevelRangeFilter">
<param name="LevelMin" value="DEBUG" />
<param name="LevelMax" value="WARN" />
</filter>
</appender>
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n" />
</layout>
</appender>
</log4net>