You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
2.3 KiB
Plaintext

12 months ago
<?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"
internalLogLevel="info"
internalLogFile="Logs\internal-nlog.txt">
<!-- enable asp.net core layout renderers -->
<extensions>
<add assembly="NLog.Web.AspNetCore" />
</extensions>
<targets>
<!-- 写入文件配置 -->
<!-- 将日志写入文件 -->
<target xsi:type="File" name="allfile" fileName="Logs\nlog-all-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring} ${newline}" />
<!-- 另一个文件日志只有自己的日志。使用一些ASP.NET核心渲染器 -->
<target xsi:type="File" name="ownFile-web" fileName="Logs\nlog-own-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action} ${newline}" />
<!-- 将日志写入控制台 -->
<target name="console" xsi:type="ColoredConsole" layout="${longdate} ${message} ${exception:format=tostring}" />
<!-- 任务台相关日志 -->
<target xsi:type="File" name="taskflow" fileName="..\TaskLogs\nlog-taskflow-${shortdate}.log"
layout="${longdate}|${uppercase:${level}}|${event-properties:item=EventId_Id}|aspnet-controller: ${aspnet-mvc-controller}|aspnet-action: ${aspnet-mvc-action}|processname:${processname}|appbasepath: ${aspnet-appbasepath}|${callsite}|${newline} |message: ${message} exception:${exception:format=tostring}" />
12 months ago
</targets>
<rules>
<!--所有日志包括来自Microsoft的-->
<!--minlevel 改为Trace 跟踪全部 Error 只捕获异常-->
<!-- <logger name="*" minlevel="Trace" writeTo="allfile" /> -->
<logger name="*" minlevel="Trace" writeTo="console" />
<!-- 任务台相关日志 -->
<logger name="TaskFlowLogger" writeTo="taskflow" />
<!--跳过非关键的Microsoft日志因此只记录自己的日志-->
<logger name="Microsoft.*" maxlevel="Info" final="true" />
<!-- BlackHole without writeTo -->
12 months ago
<logger name="*" minlevel="Trace" writeTo="ownFile-web" />
</rules>
</nlog>