我正在从log4net记录.net核心控制台应用程序。简单的RollingFileAppender文件记录功能。现在,我想通过bufferforwardingappender扩展它,但是日志未添加到文件中。 请让我知道我的log4net设置中可能是配置错误
<?xml version="1.0" encoding="utf-8" ?>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender" >
<file value="NetMQBroker" />
<encoding value="utf-8" />
<appendToFile value="true" />
<datePattern value="_yyyyMMdd'.log'" />
<staticLogFileName value="false" />
<rollingStyle value="Composite"/>
<maxSizeRollBackups value="-1"/>
<maximumFileSize value="10MB"/>
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<filter type="log4net.Filter.LevelRangeFilter">
<acceptOnMatch value="true" />
<levelMin value="DEBUG" />
<levelMax value="FATAL" />
</filter>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%d{yyyy-MM-dd HH:mm:ss.fff}	%p	AuthCoreApi	%t	%property{Ip}	%property{Context}	%property{ContextId}	%c{1}	%m%n" />
</layout>
</appender>
<appender name="MyBufferingAppender" type="log4net.Appender.BufferingForwardingAppender">
<bufferSize value="1" />
<lossy value="true" />
<appender-ref ref="RollingLogFileAppender" />
</appender>
<root>
<level value="ALL" />
<appender-ref ref="MyBufferingAppender" />
<!--<appender-ref ref="RollingLogFileAppender" />-->
</root>
</log4net>
答案 0 :(得分:0)
看来,有损价值是罪魁祸首。将其设置为false并获取输出日志
<lossy value="false" />