zoukankan      html  css  js  c++  java
  • log4net 配置

    xml

    <configuration>
      <configSections>
        <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
      </configSections>
    
      <log4net>
        <!-- OFF, FATAL, ERROR, WARN, INFO, DEBUG, ALL -->
        <!-- Set root logger level to ERROR and its appenders -->
        <root>
          <level value="DEBUG" />
          <appender-ref ref="RollingFileTracer" />
        </root>
        <!-- Print only messages of level DEBUG or above in the packages -->
        <appender name="RollingFileTracer" type="log4net.Appender.RollingFileAppender,log4net">
          <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
          <param name="File" value="App_Data/Log/" />
          <param name="AppendToFile" value="true" />
          <param name="RollingStyle" value="Composite" />
          <param name="MaxSizeRollBackups" value="10" />
          <param name="MaximumFileSize" value="1MB" />
          <param name="DatePattern" value="&quot;Logs_&quot;yyyyMMdd&quot;.txt&quot;" />
          <param name="StaticLogFileName" value="false" />
          <layout type="log4net.Layout.PatternLayout,log4net">
            <param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
          </layout>
        </appender>
      </log4net>
    </configuration>

     MvcApplication

    log4net.Config.XmlConfigurator.Configure();

    代码

    private static ILog log = LogManager.GetLogger(typeof(ZSZDbContext));
  • 相关阅读:
    java面试总结之框架问题
    数据库设计三大范式
    js 一些技巧
    el 和 fmt 常用
    iframe自适应高度
    MySQL基础
    任意精度整数算法 (BigInteger) 和任意精度小数算法 (BigDecimal)
    hibernate
    Struts2
    Servlet、Cookie、Session
  • 原文地址:https://www.cnblogs.com/kikyoqiang/p/10847182.html
Copyright © 2011-2022 走看看