开发者

Reading a Log4View Logfile using Log4net log4net.Layout.XmlLayout?

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.


Reading a Log4View Logfile using Log4net log4net.Layout.XmlLayout?

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 wh开发者_StackOverflow社区y this might not be working?


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.


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.

<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜