36 lines
1.9 KiB
Plaintext
36 lines
1.9 KiB
Plaintext
|
|
<?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">
|
|||
|
|
|
|||
|
|
<!-- enable asp.net core layout renderers -->
|
|||
|
|
<targets>
|
|||
|
|
<!--项目日志保存文件路径说明fileName="${basedir}/保存目录,以年月日的格式创建/${shortdate}/${记录器名称}-${单级记录}-${shortdate}.txt"-->
|
|||
|
|
<target name="info_file" xsi:type="File"
|
|||
|
|
fileName="${basedir}/Logs/${shortdate}/info_${shortdate}.txt"
|
|||
|
|
layout="${longdate}|${level:uppercase=true}|${logger}|${message}|${exception:format=ToString} ${newline} ${stacktrace} ${newline}"
|
|||
|
|
archiveFileName="${basedir}/archives/info_${shortdate}-{#####}.txt"
|
|||
|
|
archiveAboveSize="102400"
|
|||
|
|
archiveNumbering="Sequence"
|
|||
|
|
concurrentWrites="true"
|
|||
|
|
keepFileOpen="false" />
|
|||
|
|
<target name="error_file" xsi:type="File"
|
|||
|
|
fileName="${basedir}/Logs/${shortdate}/error_${shortdate}.txt"
|
|||
|
|
layout="${longdate}|${level:uppercase=true}|${logger}|${message}|${exception:format=ToString} ${newline} ${stacktrace} ${newline}"
|
|||
|
|
archiveFileName="${basedir}/archives/error_${shortdate}-{#####}.txt"
|
|||
|
|
archiveAboveSize="102400"
|
|||
|
|
archiveNumbering="Sequence"
|
|||
|
|
concurrentWrites="true"
|
|||
|
|
keepFileOpen="false" />
|
|||
|
|
</targets>
|
|||
|
|
|
|||
|
|
<!--规则配置,final - 最终规则匹配后不处理任何规则-->
|
|||
|
|
<!--规则配置,final - 最终规则匹配后不处理任何规则-->
|
|||
|
|
<!--定义使用哪个target输出-->
|
|||
|
|
<rules>
|
|||
|
|
<!-- 优先级从高到低依次为:OFF、FATAL、ERROR、WARN、INFO、DEBUG、TRACE、 ALL -->
|
|||
|
|
<!-- 将所有日志输出到文件 -->
|
|||
|
|
<logger name="*" minlevel="FATAL" maxlevel="FATAL" writeTo="info_file" />
|
|||
|
|
<logger name="*" minlevel="Error" writeTo="error_file" />
|
|||
|
|
</rules>
|
|||
|
|
</nlog>
|