-
Notifications
You must be signed in to change notification settings - Fork 0
/
NLog.config
20 lines (17 loc) · 1015 Bytes
/
NLog.config
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?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">
<!-- 定义日志目标 -->
<targets>
<!-- 定义一个文件目标用于存储error日志 -->
<target xsi:type="File" name="errorFile" fileName="logs/error_${shortdate}.log" layout="${longdate} ${uppercase:${level}} ${message} ${exception:format=tostring}" />
<!-- 定义一个文件目标用于存储info日志 -->
<target xsi:type="File" name="infoFile" fileName="logs/info_${shortdate}.log" layout="${longdate} ${uppercase:${level}} ${message}" />
</targets>
<!-- 定义日志规则 -->
<rules>
<!-- error日志规则:将error及以上级别的日志写入errorFile目标 -->
<logger name="*" minlevel="Error" writeTo="errorFile" />
<!-- info日志规则:将info级别的日志写入infoFile目标,但不包含更高级别的日志 -->
<logger name="*" minlevel="Info" maxlevel="Info" writeTo="infoFile" />
</rules>
</nlog>