zoukankan      html  css  js  c++  java
  • log4net.config

     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <log4net>
     3   <root>
     4     <level value="all" />
     5     <appender-ref ref="LogFileAppenderByDate" />
     6   </root>
     7   <appender name="LogFileAppenderByDate" type="log4net.Appender.RollingFileAppender" >
     8     <param name="AppendToFile" value="true" />
     9     <!--最小锁定模型以允许多个进程可以写入同一个文件-->
    10     <param name="LockingModel" value="log4net.Appender.FileAppender+MinimalLock" />
    11     <param name="StaticLogFileName" value="true" />
    12     <param name="File" value="Log\" />
    13     <param name="DatePattern" value="yyyyMM\yyyy-MM-dd'.txt'" />
    14     <param name="StaticLogFileName" value="false" />
    15     <param name="RollingStyle" value="Composite" />
    16     <maxSizeRollBackups value="-1" />
    17     <maximumFileSize value="2MB" />
    18     <layout type="log4net.Layout.PatternLayout">
    19       <param name="ConversionPattern" value="%n-----%d-----%n%level%n%c%nline %L%n%m%n" />
    20     </layout>
    21   </appender>
    22 </log4net>

    注意:<!--最小锁定模型以允许多个进程可以写入同一个文件-->

    1 <param name="LockingModel" value="log4net.Appender.FileAppender+MinimalLock" />

     上面的配置经测试是错误的,提示被进程占用,应该是以下的配置

     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <log4net>
     3   <root>
     4     <level value="all" />
     5     <appender-ref ref="LogFileAppenderByDate" />
     6   </root>
     7   <appender name="LogFileAppenderByDate" type="log4net.Appender.RollingFileAppender" >
     8     <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
     9     <param name="AppendToFile" value="true" />
    10     <param name="StaticLogFileName" value="true" />
    11     <param name="File" value="Log\" />
    12     <param name="DatePattern" value="yyyyMM\yyyy-MM-dd'.txt'" />
    13     <param name="StaticLogFileName" value="false" />
    14     <param name="RollingStyle" value="Composite" />
    15     <maxSizeRollBackups value="-1" />
    16     <maximumFileSize value="2MB" />
    17     <layout type="log4net.Layout.PatternLayout">
    18       <param name="ConversionPattern" value="%n-----%d-----%n%level%n%c%nline %L%n%m%n" />
    19     </layout>
    20   </appender>
    21 </log4net>
  • 相关阅读:
    安装ThinkPHP
    PHP数据如何向上取整
    Bootstrap 网格系统
    一篇文章让你详细了解何为JSON
    swan.onPageNotFound
    php长连接和短连接的使用场景
    写php用什么编辑器
    php随机数原理
    php接受post传值的方法
    做网站用php还是python
  • 原文地址:https://www.cnblogs.com/jonney-wang/p/5723789.html
Copyright © 2011-2022 走看看