-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnlog.config
44 lines (35 loc) · 1.99 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
<?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"
internalLogFile="log-internal.log">
<extensions>
<add assembly="NLog.Web.AspNetCore"/>
</extensions>
<!-- the targets to write to -->
<targets>
<target xsi:type="Console" name="alloutput"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}" />
<!-- write logs to file -->
<!-- fileName="/tmp/log/nlog-all-${shortdate}.log" -->
<target xsi:type="File" name="allfile" fileName="log-all-${shortdate}.log"
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 -->
<!-- fileName="/tmp/log/nlog-own-${shortdate}.log" -->
<!-- // allFileに全部吐き出すので、こちらは不要。
<target xsi:type="File" name="ownFile-web" fileName="log-own-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
-->
</targets>
<!-- rules to map from logger name to target -->
<rules>
<!--コンソールには Trace レベル以上のログすべてを出力-->
<logger name="*" minlevel="Trace" writeTo="alloutput" />
<!-- 参考:http://mslgt.hatenablog.com/entry/2018/09/06/044014 -->
<!--Microsoft.* のクラスの Info レベル以下のログはスキップ-->
<!-- <logger name="Microsoft.*" maxLevel="Info" final="true" />-->
<!-- 全部吐き出す。-->
<logger name="*" minlevel="Trace" writeTo="allfile" />
</rules>
</nlog>