Alexander Alexander - 3 years ago 100
C# Question

Log4net create new custom eventlog , but log into the Application log only

config is

<appender name="EventLogAppender" type="log4net.Appender.EventLogAppender" >
<applicationName value="MyService.exe" />
<LogName value="MyLogs" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%level %thread (%file:%line) %logger - %message%newline" />
</layout>
</appender>
<logger name="LOGGER">
<appender-ref ref="EventLogAppender" />
</logger>





  • Log4net create new custom eventlog "MyLogs", but log into the Application log with Source "MyService.exe".



How I can to say log4net log into my new custom eventlog "MyLogs" ?

Answer Source

Problem is in config in key

<applicationName value="MyService.exe" />

there should be like

 <applicationName value="MyLogs/MyService.exe" />

- and all working well !

By default log4net log into the Application log - so we need add path for our custom log.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download