使用 Log4net log4net.Layout.XmlLayout 读取 Log4View 日志文件?
我正在尝试使用 Log4View 读取 Log4net XMLLayout 输出日志文件。
<?xml version="1.0"?>
<log4net>
<appender name="fileAppender" type="log4net.Appender.FileAppender">
<!-- Note: Be sure that your user has the rights to write to this directory. -->
<file value="C:\temp\logFile1.xml" />
<appendToFile vlaue="true" />
<encoding value="unicodeFFFE" />
<layout type="log4net.Layout.XmlLayout" />
</appender>
<root>
<level value="ALL" />
<appender-ref ref="fileAppender" />
</root>
</log4net>
log4net.config - log4net 配置为输出 XmlLayout。
<?xml version="1.0"?>
<!DOCTYPE log4net:events SYSTEM "log4net-events.dtd" [<!ENTITY data SYSTEM "abc">]>
<log4net:events version="1.2" xmlns:log4net="http://logging.apache.org/log4net/schemas/log4net-events-1.2>
<log4net:event logger="hgmqtest._Default" timestamp="2011-03-28T11:07:57.0281466-04:00" level="INFO" thread="9" domain="5321f0e4-1-129457963430674694" username="DOTNET_4_WORK\leeand00">
<log4net:message>BEGIN: Page_Load</log4net:message>
<log4net:properties>
<log4net:data name="log4net:HostName" value="DOTNET_4_WORK" />
</log4net:properties>
</log4net:event>
...
</log4net:events>
C:\temp\logFile1.xml - log4net 日志文件的输出。
我已经获得了围绕日志记录语句的标签,就像 中指定的那样文档。
当我将日志文件拖到 log4view 中时,我指定文件的布局为 XML。
但是,当 Log4View 开始尝试读取 xml 文件 logFile1.xml 时,没有显示任何语句。我不断点击应用程序中应导致显示日志语句的区域,但 Log4View 中没有任何反应,尽管新语句已添加到日志文件中。
有什么想法为什么这可能行不通吗?
I'm trying to read a Log4net XMLLayout output log file using Log4View.
<?xml version="1.0"?>
<log4net>
<appender name="fileAppender" type="log4net.Appender.FileAppender">
<!-- Note: Be sure that your user has the rights to write to this directory. -->
<file value="C:\temp\logFile1.xml" />
<appendToFile vlaue="true" />
<encoding value="unicodeFFFE" />
<layout type="log4net.Layout.XmlLayout" />
</appender>
<root>
<level value="ALL" />
<appender-ref ref="fileAppender" />
</root>
</log4net>
log4net.config - log4net configured to output an XmlLayout.
<?xml version="1.0"?>
<!DOCTYPE log4net:events SYSTEM "log4net-events.dtd" [<!ENTITY data SYSTEM "abc">]>
<log4net:events version="1.2" xmlns:log4net="http://logging.apache.org/log4net/schemas/log4net-events-1.2>
<log4net:event logger="hgmqtest._Default" timestamp="2011-03-28T11:07:57.0281466-04:00" level="INFO" thread="9" domain="5321f0e4-1-129457963430674694" username="DOTNET_4_WORK\leeand00">
<log4net:message>BEGIN: Page_Load</log4net:message>
<log4net:properties>
<log4net:data name="log4net:HostName" value="DOTNET_4_WORK" />
</log4net:properties>
</log4net:event>
...
</log4net:events>
C:\temp\logFile1.xml - Output of log4net log file.
I've got the tags surrounding the logging statements just as specified in the documentation.
When I drag my log file into log4view I specify that the Layout of the file is XML.
But when Log4View starts trying to read the xml file logFile1.xml there are no statments being displayed. I keep hitting the area of my application that should cause the log statments to be displayed, but nothing happens in Log4View, although the new statements are being added to the log file.
Any ideas why this might not be working?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我有同样的问题。
这是一个错误。他们在最新的测试版中修复了这个问题。(Ver.2011.1.205.5)
导航 log4view 下载页面,单击 beta 版本选项卡并获取 beta 版本。
i had the same problem.
it's a bug. they fixed it in the newest beta release.(Ver.2011.1.205.5)
navigate log4view download page, click beta releases tab and get the beta version.
当应用程序同时记录该文件时,Log4View 可能无法访问该文件。将以下行添加到您的附加程序配置中,以放宽对其的限制。
It could be that Log4View doesn't have access to the file while the application is logging to it simultaneously. Add the following line to your appender configuration to allow loosen the restrictions on it.