-
Notifications
You must be signed in to change notification settings - Fork 0
/
NLog.config
35 lines (30 loc) · 1.85 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
<?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"
>
<!-- enable asp.net core layout renderers -->
<extensions>
<add assembly="NLog.Web.AspNetCore"/>
</extensions>
<targets>
<target name="infologfile" xsi:type="File" fileName="info.log" />
<target name="errorlogfile" xsi:type="File" fileName="error.log" />
<target name="debuglogfile" xsi:type="File" fileName="debug.log" />
<target name="logconsole" xsi:type="Console" />
<!-- File Target for own log messages with extra web details using some ASP.NET core renderers -->
<target xsi:type="File" name="ownFile-web" fileName="log/nlog-AspNetCore-own-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId_Id:whenEmpty=0}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}|${callsite}| body: ${aspnet-request-posted-body}" />
<!--Console Target for hosting lifetime messages to improve Docker / Visual Studio startup detection -->
<target xsi:type="Console" name="lifetimeConsole" layout="${level:truncate=4:lowercase=true}: ${logger}[0]${newline} ${message}${exception:format=tostring}" />
</targets>
<rules>
<logger name="*" minlevel="Info" writeTo="infologconsole" />
<logger name="*" minlevel="Info" writeTo="infologfile" />
<logger name="*" minlevel="Error" writeTo="errorlogfile" />
<logger name="*" minlevel="Debug" writeTo="debuglogfile" />
<logger name="*" minlevel="Trace" writeTo="ownFile-web" />
<!--Output hosting lifetime messages to console target for faster startup detection -->
<logger name="Microsoft.Hosting.Lifetime" minlevel="Info" writeTo="lifetimeConsole, ownFile-web" final="true" />
</rules>
</nlog>