This configuration should make my log entries end up in a custom log, right? But it ends up in the Application log. My app is running as admin. After I run my app I can confirm that the Log and event source is created by using EventLog.Exists("MyLog")
and EventLog.SourceExists("MyApplication")
.
<appender name="EventLogAppender" type="log4net.Appender.EventLogAppender" >
<logName value="MyLog"/>
<applicationName value="MyApp" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger - %message %exception%newline" />
</layout>
</appender>
Edit: I found out what the problem was but I can't "self-answer" my question until 8h has passed.
I found out the problem.
Refresh in Event View does not show new logs. I had to restart the Event Viewer to see my custom logs that I had managed to create.
Most of my log entries did end up in the Application log although I specified a log name. My conclusion is that I probably at some time early today wrote to the log using the same source name but without a log name so that it "stuck". Modifying the source name and starting over fixed the problem.
I was having the same problem where log4net created my new log, but messages kept getting logged in the Application
log. Restarting the Event Viewer did not work, but as per this answer, simply restarting my computer fixed the problem and messages started getting logged to the new log as expected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With