这是我的配置:
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net>
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
<param name="File" value="Logs\StubLog.txt" />
<param name="AppendToFile" value="true" />
<layout type="log4net.Layout.PatternLayout">
<param name="Header" value="[Header] " />
<param name="Footer" value="[Footer] " />
<param name="ConversionPattern" value="%d [%t] %-5p %c %m%n" />
</layout>
</appender>
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
<layout type="log4net.Layout.PatternLayout">
<param name="Header" value="[Header]\n" />
<param name="Footer" value="[Footer]\n\n" />
<param name="ConversionPattern" value="%d [%t] %-5p %c %m%n" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="LogFileAppender" />
<appender-ref ref="ConsoleAppender" />
</root>
<logger name="NHibernate">
<level value="WARN" />
</logger>
</log4net>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
这是日志:
[Header]
[Footer]
[Header]
2012-10-04 14:22:01,203 [1] INFO Stub.Program Enter application
2012-10-04 14:22:01,328 [1] DEBUG Stub.FrmMain Test
2012-10-04 14:22:03,265 [1] INFO Stub.Program Exit application
[Footer]
第一对页眉/页脚来自哪里?我可以消除它们吗?