zoukankan      html  css  js  c++  java
  • NLog 配置文件按固定大小生成多文件

    <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
       <targets>
         <target name="log" xsi:type="File" fileName="${basedir}/Log/${shortdate}_log.txt" encoding="utf-8" archiveNumbering="Sequence" archiveAboveSize="104857600"/>
         <target name="debug" xsi:type="File" fileName="${basedir}/Log/${shortdate}_debug.txt" encoding="utf-8" archiveNumbering="Sequence" archiveAboveSize="104857600"/>
         <target name="trace" xsi:type="File" fileName="${basedir}/Log/${shortdate}_trace.txt" encoding="utf-8" archiveNumbering="Sequence" archiveAboveSize="104857600"/>
         <target name="exception" xsi:type="File" fileName="${basedir}/Log/${shortdate}_exception.txt" layout="${longdate} | ${level:uppercase=false} | ${message} ${onexception:${exception:format=tostring} ${newline} ${stacktrace} ${newline}" encoding="utf-8" archiveNumbering="Sequence" archiveAboveSize="104857600" />
         <target name="system" xsi:type="File" fileName="${basedir}/Log/system.txt" encoding="utf-8" archiveNumbering="Sequence" archiveAboveSize="104857600"></target>
       </targets>
       <rules>
         <logger name="system" level="Info" writeTo="system" />
         <logger name="*" level="Debug" writeTo="debug"/>
         <logger name="*" level="Trace" writeTo="trace"/>
         <logger name="*" level="Info" writeTo="log"/>
         <logger name="*" level="Error" writeTo="exception"/>
       </rules>  
    </nlog>


    参数:

    文件编码:encoding="utf-8"

    文件分割文件名附加数字顺序:archiveNumbering="Sequence"

    文件分割文件名附加日期与数字顺序:archiveNumbering="DateAndSequence"

    DateAndSequence中日期格式:archiveDateFormat="yyyyMMdd"

    文件分割大小:单位=字节 archiveAboveSize="104857600“

  • 相关阅读:
    AOJ.866 飞越原野 (三维BFS)
    UVA.129 Krypton Factor (搜索+暴力)
    UVA.10986 Fractions Again (经典暴力)
    UVA.10305 Maximum Product (暴力)
    UVA.725 Division (暴力)
    HDU.3342 Legal or Not (拓扑排序 TopSort)
    HDU.2647 Reward(拓扑排序 TopSort)
    13 成都
    15 沈阳
    14 鞍山
  • 原文地址:https://www.cnblogs.com/94cool/p/14785735.html
Copyright © 2011-2022 走看看