• 日志管理


    采用log4net+Common.Logging.Log4Net

    1、Nuget:Common.Logging.Log4Net208 自动下载完四个包

    2、配置config 

    Common:

    <sectionGroup name="common">
          <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
        </sectionGroup>

    <!--与log4net关联-->
    <common>
    <logging>
    <factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4net208">
    <arg key="configType" value="FILE-WATCH" />
    <arg key="configFile" value="~/Conf/log4net.config" />
    <arg key="level" value="INFO" />
    </factoryAdapter>
    </logging>
    </common>

    Log4net:log4net.config

    <configuration>
      <configSections>
        <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
      </configSections>
      <log4net>

    <root>
    <level value="ALL"/>
    <appender-ref ref="LogFileAppender"/>
    </root>
    <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
    <param name="File" value="my_log-file.txt"/>
    <param name="AppendToFile" value="true"/>
    <layout type="log4net.Layout.PatternLayout">
    <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n"/>

    </layout>

    </appender>

    <logger name="yateJob" additivity="false" >
    <level value="ALL" />
    <appender-ref ref="yateJobTxtAppender" />
    </logger>
    </log4net>
    </configuration>

     log4初始化:log4net.Config.XmlConfigurator.Configure();

    3、扩展

  • 相关阅读:
    vue axios创建实例
    vue axios全局配置
    vue axios并发请求
    vue axios HTTP 库
    vuex actions异步操作
    vuex getters
    Go并发控制--Channel篇
    UVA10228 A Star not a Tree?
    P1395 会议
    P1337 [JSOI2004]平衡点 / 吊打XXX
  • 原文地址:https://www.cnblogs.com/zzfy/p/9652338.html
Copyright © 2020-2023  润新知