zoukankan      html  css  js  c++  java
  • 常用NLog配置

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
       
        <configSections>
          <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
        </configSections>
      
        <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
          <targets>
            <target name="file" xsi:type="File"
                layout="${longdate} ${logger} ${message}${exception:format=ToString}"
                fileName="${basedir}/logs/${shortdate}.log"
                keepFileOpen="true"
                encoding="utf-8" />
            <target name="f1" xsi:type="File" fileName="file1.txt"/>
            <!--layout代表日志的格式-->
            <target name="f2" xsi:type="File" fileName="file2.txt" layout="${date:format=yyyyMMddHHmmss} ${callsite} ${level} ${message}"/>
            <target name="n1" xsi:type="Network" address="tcp://localhost:4001"/>
            <target name="ds" xsi:type="OutputDebugString"/>
          </targets>
    
          <rules>
            <!--writeTo使用哪个target-->
            <logger name="*" minlevel="Debug" writeTo="f2" />
            <logger name="mylog" minlevel="Debug" writeTo="f1" />
            <logger name="test" levels="Debug,Error" writeTo="n1"/>
          </rules>
        </nlog>
    
    
      <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
      </startup>
    
    </configuration>

    直接复制 ,更改writeTo属性就 可以 使用。

  • 相关阅读:
    js基础练习题(2)
    js基础练习题(1)
    DOM-BOM-EVENT(7)
    DOM-BOM-EVENT(6)
    DOM-BOM-EVENT(5)
    DOM-BOM-EVENT(4)
    DOM-BOM-EVENT(3)
    Spark学习笔记--Spark在Windows下的环境搭建(转)
    idea下关联spark源码环境(转)
    Spark 性能相关参数配置详解-任务调度篇
  • 原文地址:https://www.cnblogs.com/zhaotianff/p/9219660.html
Copyright © 2011-2022 走看看