log4net的/ EventLogAppender无视我的LOGNAME [英] log4net / EventLogAppender is ignoring my LogName
问题描述
这个配置应该让我的日志条目自定义日志结束了,对不对?但是,在应用程序日志结束。我的应用程序正在运行的管理。我跑我的应用程序后,我可以证实,日志和事件源使用 EventLog.Exists(MyLog)
和 EventLog.SourceExists(创建所有MyApplication)
<预类=郎咸平的XML prettyprint-覆盖>
<追加程序名称=EventLogAppender TYPE =log4net.Appender.EventLogAppender>
< LOGNAME值=MyLog/>
<的applicationName值=MyApp的/>
<布局类型=log4net.Layout.PatternLayout>
< conversionPattern值=%DATE [%线程]%-5level%记录仪 - 消息%%异常%换行/>
< /布局>
< /附加器>
编辑:我发现了问题是什么,但我不能自我回答我的问题直到8小时已经过去了。
我发现了这个问题。
-
刷新事件视图不显示新日志。我不得不重新启动事件查看器看到,我设法创建我的自定义日志。
-
我的大部分日志条目都在应用程序日志虽然结束了我指定了一个日志名称。我的结论是,我可能在一段时间内使用相同的源名称今日早盘写信给日志,但没有一个日志名称,以便它卡壳。修改源名称,并重新开始解决了这一问题。
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.
这篇关于log4net的/ EventLogAppender无视我的LOGNAME的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!