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.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
<?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}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring} ${newline}" />
</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 -->
<logger name= "*" minlevel= "Trace" writeTo= "ownFile-web" />
</rules>
</nlog>