log4net配置

<?xml version="1.0" encoding="UTF-8"?>
<log4net>
  <root>
    <level value="all" />
    <appender-ref ref="LogFileAppenderByDate" />
  </root>
  <appender name="LogFileAppenderByDate" type="log4net.Appender.RollingFileAppender" >
    <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
    <param name="AppendToFile" value="true" />
    <param name="Encoding" value="utf-8" />
    <param name="StaticLogFileName" value="true" />
    <param name="File" value="Log\\" />
    <param name="DatePattern" value="yyyyMM\\yyyy-MM-dd'.txt'" />
    <param name="StaticLogFileName" value="false" />
    <param name="RollingStyle" value="Composite" />
    <maxSizeRollBackups value="-1" />
    <maximumFileSize value="2MB" />
    <layout type="log4net.Layout.PatternLayout">
      <param name="ConversionPattern" value="%n-----%d-----line %L-----%level-----%c%n%m%n" />
    </layout>
  </appender>
</log4net>

 

上一篇:【log4net】- 日志使用教程


下一篇:Log4Net MaxSizeRollBackups和MaxFileSize不生效问题解决办法