初版的功能
This commit is contained in:
52
FATrace.WPLApp/NLog.config
Normal file
52
FATrace.WPLApp/NLog.config
Normal file
@@ -0,0 +1,52 @@
|
||||
<?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"
|
||||
autoReload="true"
|
||||
throwConfigExceptions="true"
|
||||
internalLogLevel="Warn"
|
||||
internalLogFile="${basedir}/logs/internal-nlog.log">
|
||||
|
||||
<!-- 全局参数 -->
|
||||
<variable name="logDir" value="${basedir}/logs" />
|
||||
<variable name="layout" value="${longdate}|${level:uppercase=true}|${logger}|${threadid}|${message}${onexception:inner=|${exception:format=tostring}}" />
|
||||
|
||||
<targets>
|
||||
<!-- 调试器输出(调试时可见) -->
|
||||
<target xsi:type="Debugger" name="debugger" layout="${layout}" />
|
||||
|
||||
<!-- 常规滚动文件:按日期分割,超过大小归档,保留30天 -->
|
||||
<target xsi:type="File" name="allfile"
|
||||
fileName="${logDir}/${shortdate}.log"
|
||||
archiveFileName="${logDir}/archive/${shortdate}.{#}.log"
|
||||
archiveNumbering="Sequence"
|
||||
archiveAboveSize="10485760"
|
||||
maxArchiveFiles="30"
|
||||
concurrentWrites="true"
|
||||
keepFileOpen="false"
|
||||
encoding="utf-8"
|
||||
layout="${layout}" />
|
||||
|
||||
<!-- 错误与致命日志单独文件 -->
|
||||
<target xsi:type="File" name="errorfile"
|
||||
fileName="${logDir}/${shortdate}_error.log"
|
||||
archiveFileName="${logDir}/archive/${shortdate}_error.{#}.log"
|
||||
archiveNumbering="Sequence"
|
||||
archiveAboveSize="10485760"
|
||||
maxArchiveFiles="60"
|
||||
concurrentWrites="true"
|
||||
keepFileOpen="false"
|
||||
encoding="utf-8"
|
||||
layout="${layout}" />
|
||||
</targets>
|
||||
|
||||
<rules>
|
||||
<!-- 调试器输出:所有级别 -->
|
||||
<logger name="*" minlevel="Debug" writeTo="debugger" />
|
||||
|
||||
<!-- 常规文件:记录 Debug/Info/Warn/Error/Fatal 全部 -->
|
||||
<logger name="*" minlevel="Debug" writeTo="allfile" />
|
||||
|
||||
<!-- 错误文件:仅记录 Error/Fatal -->
|
||||
<logger name="*" minlevel="Error" writeTo="errorfile" />
|
||||
</rules>
|
||||
</nlog>
|
||||
Reference in New Issue
Block a user