Repository navigation
Expand file tree
/
Copy pathnlog.config
More file actions
59 lines (53 loc) · 2.36 KB
/
Copy pathnlog.config
File metadata and controls
59 lines (53 loc) · 2.36 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?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" throwExceptions="false">
<variable name="logDirectory" value="${basedir}/App_Data"/>
<extensions>
<add assembly="NLog.Mongo"/>
</extensions>
<targets async="true">
<target name="csv" xsi:type="File" fileName="${logDirectory}/log.csv"
archiveFileName="${logDirectory}/archives/log.{#}.csv"
archiveEvery="Day"
archiveNumbering="Rolling"
maxArchiveFiles="7"
concurrentWrites="true"
createDirs="true"
autoFlush="true">
<layout xsi:type="CSVLayout">
<column name="time" layout="${longdate}" />
<column name="level" layout="${level}"/>
<column name="thread" layout="${threadid}" />
<column name="logger" layout="${logger}"/>
<column name="project" layout="${event-context:item=project}" />
<column name="message" layout="${message}" />
<column name="exception" layout="${exception:format=tostring}" />
</layout>
</target>
<target name="file" xsi:type="File"
layout="${longdate} ${threadid:padding=4} ${level:uppercase=true:padding=5} ${logger} ${event-context:item=project} ${message} ${exception:format=tostring}"
fileName="${logDirectory}/log.txt"
archiveFileName="${logDirectory}/archives/log.{#}.txt"
archiveEvery="Day"
archiveNumbering="Rolling"
maxArchiveFiles="7"
concurrentWrites="true"
createDirs="true"
autoFlush="true" />
<target name="mongo" xsi:type="AsyncWrapper">
<target xsi:type="Mongo" connectionName="MongoConnectionString" collectionName="log" cappedCollectionSize="26214400">
<field name="time" layout="${longdate}" />
<field name="level" layout="${level}"/>
<field name="thread" layout="${threadid}" />
<field name="logger" layout="${logger}"/>
<field name="project" layout="${event-context:item=project}" />
<field name="message" layout="${message}" />
<field name="exception" layout="${exception:format=tostring}" />
</target>
</target>
</targets>
<rules>
<logger name="*" minlevel="Warn" writeTo="mongo" />
</rules>
</nlog>