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.
ProductionSystem/ProductionSystem_Log/nlog.config

29 lines
1.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xsi:schemaLocation="NLog NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true" throwExceptions="false">
<!-- the targets to write to -->
<targets>
<!--单个文件过大会导致写入效率下降,可配置单个文件的最大容量-->
<target name="File" xsi:type="AsyncWrapper" queueLimit="5000" overflowAction="Discard">
<target xsi:type="File"
createDirs="true"
fileName="${basedir}/logs/${level}/${shortdate}.log"
layout="${date:yyyy-MM-dd HH\:mm\:ss} ${level:uppercase=true} ${message} ${event-context:item=Amount} ${stacktrace} ${exception}"
archiveAboveSize="10240"
archiveEvery="Day"
maxArchiveDays="7"
/>
</target>
<!-- write logs to file -->
<!--<target xsi:type="File" name="logfile" fileName="c:\temp\console-example.log"
layout="${longdate}|${level}|${message} |${all-event-properties} ${exception:format=tostring}" />-->
<!--<target xsi:type="Console" name="logconsole"
layout="${longdate}|${level}|${message} |${all-event-properties} ${exception:format=tostring}" />-->
</targets>
<!-- rules to map from logger name to target -->
<rules>
<!--<logger name="*" levels="Debug,Info,Warn,Error" writeTo="File" />-->
<logger name="*" minlevel="Debug" maxlevel="Error" writeTo="File" />
</rules>
</nlog>