You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
2.0 KiB
57 lines
2.0 KiB
<?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" |
|
internalLogLevel="Warn" internalLogFile="nlog-internal.log"> |
|
|
|
<!-- optional, add some variables |
|
https://github.com/nlog/NLog/wiki/Configuration-file#variables |
|
--> |
|
<extensions> |
|
<add assembly="NLog.Web.AspNetCore"/> |
|
</extensions> |
|
<!--<variable name="myvar" value="myvalue"/>--> |
|
<variable name="year" value="${date:format=yyyy}"/> |
|
<variable name="year_month" value="${date:format=yyyy-MM}"/> |
|
<!-- |
|
See https://github.com/nlog/nlog/wiki/Configuration-file |
|
for information on customizing logging rules and outputs. |
|
--> |
|
<targets async="true"> |
|
|
|
<!-- |
|
add your targets here |
|
See https://github.com/nlog/NLog/wiki/Targets for possible targets. |
|
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers. |
|
--> |
|
|
|
<!-- |
|
Write events to a file with the date in the filename. |
|
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log" |
|
layout="${longdate} ${uppercase:${level}} ${message}" /> |
|
--> |
|
<target xsi:type="AsyncWrapper" name="MyLogger"> |
|
<target xsi:type="File" |
|
layout="${longdate},${uppercase:${level}},${message}" |
|
fileName="${basedir}/Log/${level}/${year}/${year_month}/${shortdate}.log" encoding="utf-8" /> |
|
</target> |
|
|
|
<target xsi:type="Null" name="blackhole" /> |
|
</targets> |
|
|
|
|
|
|
|
<rules> |
|
<!-- add your logging rules here --> |
|
|
|
<!-- |
|
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f" |
|
<logger name="*" minlevel="Debug" writeTo="f" /> |
|
--> |
|
<!--跳过Microsoft的系统日志--> |
|
<logger name="Microsoft.*" minlevel="Trace" writeTo="blackhole" final="true" /> |
|
<logger name="*" minlevel="Debug" writeTo="MyLogger" final="true"/> |
|
<logger name="Microsoft.*" minlevel="Warn" writeTo="MyLogger" final="true"/> |
|
</rules> |
|
</nlog>
|
|
|