zoukankan      html  css  js  c++  java
  • 【.NET / C#】NLog.config

    <?xml version="1.0" encoding="utf-8" ?>
    <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
          autoReload="true" throwExceptions="false">
    
      <variable name="log.path" value="D:/logs/"/>
      <variable name="log.name" value="ApplicationName"/>
      <variable name="log.pattern" value="[${longdate}] [${level:uppercase=true:padding=-5}] [${threadid}] [${logger}] ${message}"/>
      <variable name="log.file" value="${level}_${log.name}.log"/>
      <variable name="log.archive" value="${date:format=MM}/${date:format=dd}/${level}_${log.name}_{##}.log"/>
      
      <targets async="true">
        <!--保存至文件-->
        <target name="log" xsi:type="AsyncWrapper">
          <target xsi:type="File"
                fileName="${log.path}${log.name}/${log.file}"
                layout="${log.pattern}"
                archiveFileName="${log.path}${log.name}/${log.archive}"
                archiveEvery="Day"
                archiveAboveSize="104857600"
                archiveNumbering="DateAndSequence"
                archiveDateFormat="yyyyMMdd"
                concurrentWrites="true"
                maxArchiveFiles="99"
                encoding="UTF-8"
                keepFileOpen="false" />
        </target>
        
        <!--输出至控制台-->
        <!--
        <target name="console" xsi:type="AsyncWrapper">
          <target xsi:type="ColoredConsole"
                  layout="[${level:uppercase=true:padding=-5}] [${date:format=yyyy-MM-dd HH:mm:ss,fff}] [${message}] ${newline}" >
            <highlight-row condition="level == LogLevel.Trace" foregroundColor="Gray" />
            <highlight-row condition="level == LogLevel.Debug" foregroundColor="White" />
            <highlight-row condition="level == LogLevel.Info" foregroundColor="Green" />
            <highlight-row condition="level == LogLevel.Warn" foregroundColor="Yellow" />
            <highlight-row condition="level == LogLevel.Error" foregroundColor="Magenta" />
            <highlight-row condition="level == LogLevel.Fatal" foregroundColor="Red" />
          </target>
        </target>
        -->
        
        <!--输出至Debugger-->
        <!--
        <target name="debugger" xsi:type="AsyncWrapper">
          <target xsi:type="Debugger"
                  layout="NLog: ${shorttime} > ${message}" />
        </target>
        -->
      </targets>
    
      <rules>
        <logger name="*" minlevel="Trace" writeTo="log" />
        <!--<logger name="*" minlevel="Debug" writeTo="console" />-->
        <!--<logger name="*" minlevel="Debug" writeTo="debugger" />-->
      </rules>
      
    </nlog>
    
  • 相关阅读:
    什么是架构
    intellij idea新建maven项目,一直loading archetype list.....
    maven使用出现的错误
    mock使用中出现的错误
    9个最好用的在线编译/调试工具
    Junit测试中找不到junit.framework.testcase
    mysql图形化界面MySQL_Workbench
    win7下mysql免安装版使用
    qemu安装
    逻辑卷管理
  • 原文地址:https://www.cnblogs.com/zhuzhongxing/p/14147092.html
Copyright © 2011-2022 走看看