forked from zhontai/Admin.Core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnlog.config
More file actions
30 lines (30 loc) · 1.86 KB
/
nlog.config
File metadata and controls
30 lines (30 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?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" internalLogLevel="Info">
<!-- 启用.net core的核心布局渲染器 -->
<extensions>
<add assembly="NLog.Web.AspNetCore" />
</extensions>
<!-- 写入日志的目标配置 archiveAboveSize="102400" maxArchiveDays="60" -->
<targets>
<!-- 调试 -->
<target xsi:type="File" name="debug" fileName="../logs/debug-${shortdate}.log" layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
<!-- 警告 -->
<target xsi:type="File" name="warn" fileName="../logs/warn-${shortdate}.log" layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
<!-- 错误 -->
<target xsi:type="File" name="error" fileName="../logs/error-${shortdate}.log" layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
<!-- 控制台 -->
<target xsi:type="Console" name="console" layout="${message}" />
</targets>
<!-- 映射规则 -->
<rules>
<!-- 调试 -->
<logger name="*" minlevel="Trace" maxlevel="Debug" writeTo="debug" />
<!--<logger name="*" minlevel="Trace" writeTo="console" />-->
<!-- 警告 -->
<logger name="*" minlevel="Info" maxlevel="Warn" writeTo="warn" />
<!-- 错误 -->
<logger name="*" minlevel="Error" maxlevel="Fatal" writeTo="error" />
<!--跳过不重要的微软日志-->
<logger name="Microsoft.*" maxlevel="Info" final="true" />
</rules>
</nlog>