-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c8c40ce
commit 1e01477
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
examples/ASP.NET Core 3/ASP.NET Core 3 - VS2019/NLog.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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" | ||
throwConfigExceptions="true" | ||
internalLogLevel="info" | ||
internalLogFile="c:\temp\internal-nlog-AspNetCore3.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="c:\temp\nlog-AspNetCore3-all-${shortdate}.log" | ||
layout="${longdate}|${event-properties:item=EventId_Id:whenEmpty=0}|${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="c:\temp\nlog-AspNetCore3-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}" /> | ||
</targets> | ||
|
||
<!-- rules to map from logger name to target --> | ||
<rules> | ||
<!--All logs, including from Microsoft--> | ||
<logger name="*" minlevel="Trace" writeTo="allfile" /> | ||
|
||
<!--Skip non-critical Microsoft logs and so log only own logs--> | ||
<logger name="Microsoft.*" maxlevel="Info" final="true" /> <!-- BlackHole --> | ||
|
||
<logger name="*" minlevel="Trace" writeTo="ownFile-web" /> | ||
</rules> | ||
</nlog> |