0
我有Log4Net設置爲輸出XML,我想看看是否有人知道如何添加自定義屬性,將在XML中輸出爲單獨的節點。Log4Net XmlLayout自定義屬性
下面是當前log4net的配置:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net"/>
</configSections>
<log4net>
<root>
<level value="DEBUG"/>
<appender-ref ref="LogFileAppender" />
</root>
<appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender" >
<file type="log4net.Util.PatternString" value="C:\Log.xml"/>
<appendToFile value="true" />
<rollingStyle value="Size" />
<maximumFileSize value="10MB" />
<maxSizeRollBackups value="5000" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.XmlLayoutSchemaLog4j">
<locationInfo value="true"/>
</layout>
<param name="Encoding" value="utf-8" />
<filter type="log4net.Filter.PropertyFilter">
<Key value="Version" />
<StringToMatch value="1" />
</filter>
</appender>
</log4net>
</configuration>
我已經看到了寫SQL時,這樣一個帖子,但沒有對XML寫作,我似乎無法彌補缺口存在。顯然,我們的目標是將諸如UserID,ClientID等屬性作爲單獨的xml節點,所以我們在Log4Net查看器中使用更好的過濾控制(使用YALV)