Hello everyone!
A couple of weeks ago I've discovered log4net and I couldn't be happier with my initial results. So far I've been using the factory settings (BasicConfigurator.Configure()
), but now I feel like going a step further and trying some customized configurations.
I've wrestled my way to make the application read the configuration file and whatnot and actually I'm having decent results but I was wondering how should I enable the remaining logging levels? (namely DEBUG
, WARN
, ERROR
) I've tried adding all of them inside the <root>
element but it doesn't work.
Currently I'm using the following configuration file:
<appender name="Console" type="log4net.Appender.ColoredConsoleAppender">
<mapping>
<level value="DEBUG" />
<foreColor value="White" />
<backColor value="Blue" />
</mapping>
<mapping>
<level value="INFO" />
<foreColor value="White" />
<backColor value="Green" />
</mapping>
<mapping>
<level value="WARN" />
<foreColor value="White" />
<backColor value="Yellow" />
</mapping>
<mapping>
<level value="ERROR" />
<foreColor value="White" />
<backColor value="Red" />
</mapping>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
</layout>
</appender>
<root>
<appender-ref ref="Console" />
</root>
If any of you guys would kindly go ahead and point what I'm missing I'd be a really happy programmer today. Thanks much in advance for all your feedback!
UPDATE: not specifying a log level (<level value="INFO" />
) solves the problem as log4net will enable all of them by default.