2022-08-06 18:21:00 +08:00
|
|
|
<?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"
|
2022-08-08 15:16:42 +08:00
|
|
|
internalLogLevel="Error"
|
2022-08-06 18:21:00 +08:00
|
|
|
internalLogFile="./logs/internal-nlog-AspNetCore.txt">
|
|
|
|
|
|
|
|
<!-- enable asp.net core layout renderers -->
|
|
|
|
<extensions>
|
|
|
|
<add assembly="NLog.Web.AspNetCore"/>
|
|
|
|
</extensions>
|
|
|
|
|
|
|
|
<!-- the targets to write to -->
|
|
|
|
<targets>
|
|
|
|
<!-- File Target for own log messages with extra web details using some ASP.NET core renderers -->
|
2022-12-12 09:14:42 +08:00
|
|
|
<target xsi:type="File" name="ownFile-web" fileName="./logs/${shortdate}_${level}.log"
|
|
|
|
archiveEvery="Hour" archiveAboveSize="10485760"
|
2022-08-06 18:21:00 +08:00
|
|
|
maxArchiveDays="7"
|
2022-09-14 20:51:12 +08:00
|
|
|
maxArchiveFiles="10"
|
|
|
|
layout="${longdate}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}|${callsite}" />
|
2022-08-06 18:21:00 +08:00
|
|
|
|
|
|
|
<!--Console Target for hosting lifetime messages to improve Docker / Visual Studio startup detection -->
|
|
|
|
<target xsi:type="Console" name="lifetimeConsole" layout="${MicrosoftConsoleLayout}" />
|
|
|
|
</targets>
|
|
|
|
|
|
|
|
<!-- rules to map from logger name to target -->
|
|
|
|
<rules>
|
|
|
|
<!--Output hosting lifetime messages to console target for faster startup detection -->
|
|
|
|
<logger name="Microsoft.Hosting.Lifetime" minlevel="Info" writeTo="lifetimeConsole, ownFile-web" final="true" />
|
|
|
|
|
|
|
|
<!--Skip non-critical Microsoft logs and so log only own logs (BlackHole) -->
|
2022-09-14 20:51:12 +08:00
|
|
|
<logger name="Microsoft.*" minlevel="Error" final="true" />
|
|
|
|
<logger name="System.Net.Http.*" minlevel="Error" final="true" />
|
2022-08-06 18:21:00 +08:00
|
|
|
|
2023-04-12 23:40:00 +08:00
|
|
|
<logger name="*" minlevel="Error" writeTo="ownFile-web" />
|
2022-08-06 18:21:00 +08:00
|
|
|
</rules>
|
|
|
|
</nlog>
|