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.
|
|
|
<?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"
|
|
|
|
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
|
|
|
autoReload="true"
|
|
|
|
keepVariablesOnReload="false"
|
|
|
|
throwExceptions="true"
|
|
|
|
throwConfigExceptions="true"
|
|
|
|
internalLogLevel="Trace"
|
|
|
|
internalLogFile="${basedir}\logs\internal-nlog.txt"
|
|
|
|
>
|
|
|
|
<!--引入Nlog扩展包-->
|
|
|
|
<extensions>
|
|
|
|
<add assembly="NLog.Web.AspNetCore"/>
|
|
|
|
</extensions>
|
|
|
|
|
|
|
|
<!--自定义变量-->
|
|
|
|
<variable name="myvariable" value="test" />
|
|
|
|
|
|
|
|
<!--设置目标-->
|
|
|
|
<targets>
|
|
|
|
<!--默认彩色控制台-->
|
|
|
|
<target xsi:type="ColoredConsole"
|
|
|
|
name="ColoredConsoleLog"
|
|
|
|
encoding="utf-8"
|
|
|
|
layout="${longdate}|${level:uppercase=true}|${logger}|${message}|${event-properties:WebUser}|${event-properties:WebUser:objectpath=Id}"
|
|
|
|
/>
|
|
|
|
<!--调试窗口-->
|
|
|
|
<target name="debugLog" xsi:type="Debugger" layout="${logger}::${message}"/>
|
|
|
|
<!--layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}"-->
|
|
|
|
<!--写入通用日志文件-->
|
|
|
|
<target xsi:type="File" name="allfile" fileName="${basedir}\logs\nlog-all-${shortdate}.log">
|
|
|
|
<layout xsi:type="CompoundLayout">
|
|
|
|
<layout xsi:type="SimpleLayout" text="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}" />
|
|
|
|
<layout xsi:type="JsonLayout">
|
|
|
|
<attribute name="time" layout="${longdate}" />
|
|
|
|
<attribute name="level" layout="${level:upperCase=true}"/>
|
|
|
|
<attribute name="message" layout="${message}" />
|
|
|
|
</layout>
|
|
|
|
</layout>
|
|
|
|
|
|
|
|
</target>
|
|
|
|
|
|
|
|
</targets>
|
|
|
|
|
|
|
|
<!--设置规则-->
|
|
|
|
<rules>
|
|
|
|
<logger ruleName="*" minlevel="Debug" writeTo="ColoredConsoleLog,debugLog,allfile" />
|
|
|
|
</rules>
|
|
|
|
</nlog>
|