-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnlog.config
24 lines (22 loc) · 1.23 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
<?xml version="1.0" encoding="utf-8" ?>
<nlog internalLogFile="C:/DemoApi.txt" internalLogLevel="Error" throwExceptions="true" xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<extensions>
<add assembly="NLog.Web.AspNetCore"/>
</extensions>
<targets async="false">
<target xsi:type="FallbackGroup" name="LogDb" returnToFirstOnSuccess="true">
<target name="LogDatabase" xsi:type="Database" connectionString="${gdc:item=connectionString}" commandType="StoredProcedure" commandText="[dbo].[EventCreate]">
<parameter name="@Level" layout="${level}" />
<parameter name="@Source" layout="${literal:text=Demo Api}" />
<parameter name="@Type" layout="${literal:text=Logger}" />
<parameter name="@Message" layout="${message}" />
<parameter name="@Timestamp" layout="${date:format=yyyy-MM-ddTHH\:mm\:ss.fffzzz}" />
<parameter name="@User" layout="${when:when=length('${gdc:item=user}') > 0:inner=${gdc:item=user}:else=?}" />
<parameter name="@Data" layout="${all-event-properties}" />
</target>
</target>
</targets>
<rules>
<logger name="*" minlevel="Info" writeTo="LogDb" />
</rules>
</nlog>