-
Notifications
You must be signed in to change notification settings - Fork 0
/
NLog.config
37 lines (32 loc) · 1.82 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
<?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="${basedir}/logs/internal-nlog.txt">
<!-- enable asp.net core layout renderers -->
<extensions>
<add assembly="NLog.Web.AspNetCore"/>
</extensions>
<!-- the targets to write to -->
<targets>
<!-- write logs to file -->
<target xsi:type="File" name="allfile" fileName="${basedir}/logs/${shortdate}.txt"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}" />
<target xsi:type="File" name="BotApiFile" fileName="${basedir}/logs/BotApi-${shortdate}.txt"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}" />
<!-- another file log, only own logs. Uses some ASP.NET core renderers -->
<target xsi:type="File" name="ownFile-web" fileName="${basedir}/logs/${shortdate}.txt"
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="logConsole" layout="${longdate} ${callsite} ${level} ${message}"></target>
</targets>
<!-- rules to map from logger name to target -->
<rules>
<logger name="CryptoTelegram.Controllers.*" writeTo="BotApiFile" />
<logger name="CryptoTelegram.Data.Work.*" writeTo="BotApiFile" />
<!--All logs, including from Microsoft-->
<logger name="*" minlevel="Trace" writeTo="allfile" />
<logger name="*" minlevel="Info" writeTo="logConsole" />
</rules>
</nlog>