Files
FATrace/FATrace.WPLApp/NLog.config
2025-11-11 17:26:31 +08:00

53 lines
2.0 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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>