I want to send Info Level & above to the XML appender and Error/Fatal Level to the EventLog appender.
I gather that I need to modify the root element of the config but I'm struggling with the syntax. What is the configuration syntax to direct logs to the correct appender for a given level or range of levels?
This is the configuration so far:
<log4net>
<appender name="SomeXmlAppender" type="log4net.Appender.RollingFileAppender">
...
</appender>
<appender name="SomeEventLogAppender" type="log4net.Appender.EventLogAppender">
...
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="SomeXmlAppender" />
<appender-ref ref="SomeEventLogAppender" />
</root>
</log4net>
Edit: Thanks @agileguy. That post did indeed contain the syntaxt I needed. The working solution now looks like this:
<log4net>
<appender name="SomeXmlAppender" type="log4net.Appender.RollingFileAppender">
...
<evaluator type="log4net.Core.LevelEvaluator">
<threshold value="INFO"/>
</evaluator>
<filter type="log4net.Filter.LevelRangeFilter">
<levelMin value="INFO" />
<acceptOnMatch value="true" />
</filter>
<filter type="log4net.Filter.DenyAllFilter" />
</appender>
<appender name="SomeEventLogAppender" type="log4net.Appender.EventLogAppender">
...
<evaluator type="log4net.Core.LevelEvaluator">
<threshold value="ERROR"/>
</evaluator>
<filter type="log4net.Filter.LevelRangeFilter">
<levelMin value="ERROR" />
<acceptOnMatch value="true" />
</filter>
<filter type="log4net.Filter.DenyAllFilter" />
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="SomeXmlAppender" />
<appender-ref ref="SomeEventLogAppender" />
</root>
</log4net>