-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnlog.config
46 lines (42 loc) · 2.44 KB
/
nlog.config
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?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="Trace"
throwExceptions="true"
internalLogFile="/logs/internal-nlog.txt">
<targets>
<target name="general" xsi:type="File" fileName="${basedir}/logs/${shortdate}_general.json">
<layout xsi:type="JsonLayout">
<attribute name="time" layout="${longdate}" />
<attribute name="level" layout="${level:upperCase=true}"/>
<attribute name="function" layout="${callsite:includeSourcePath=true}"/>
<attribute name="message" layout="${message}${exception:format=tostring,Data:maxInnerExceptionLevel=10}" />
<attribute name="traceIdentifier" layout="${aspnet-TraceIdentifier}" />
</layout>
</target>
<target name="global_exception" xsi:type="File" fileName="${basedir}/logs/${shortdate}_global_exception.json">
<layout xsi:type="JsonLayout">
<attribute name="time" layout="${longdate}" />
<attribute name="level" layout="${level:upperCase=true}"/>
<attribute name="function" layout="${callsite:includeSourcePath=true}"/>
<attribute name="message" layout="${message}${exception:format=tostring,Data:maxInnerExceptionLevel=10}" />
<attribute name="traceIdentifier" layout="${aspnet-TraceIdentifier}" />
<attribute name="clientIp" layout="${aspnet-Request-Ip:CheckForwardedForHeader=true}" />
<attribute name="method" layout="${aspnet-Request-Method}" />
<attribute name="queryString" layout="${aspnet-Request-QueryString}" />
<attribute name="userAgent" layout="${aspnet-Request-UserAgent}" />
<attribute name="url" layout="${aspnet-Request-Url:IncludePort=true:IncludeQueryString=true}" />
<attribute name="headers" layout="${aspnet-Request-Headers}" />
</layout>
</target>
<target xsi:type="Null" name="blackhole" />
</targets>
<rules>
<logger name="Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware" writeTo="global_exception" />
<logger name="Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware" writeTo="global_exception" />
<logger name="global_exception" writeTo="global_exception" />
<logger name="Microsoft.EntityFrameworkCore.*" maxlevel="Info" writeTo="blackhole" final="true" />
<logger name="*" minlevel="Trace" writeTo="general" />
</rules>
</nlog>