<?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">
<!--
See https://github.com/nlog/nlog/wiki/Configuration-file
for information on customizing logging rules and outputs.
-->
<targets>
<!-- add your targets here -->
<!--
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
layout="${longdate} ${uppercase:${level}} ${message}" />
-->
<!--说明:
xsi:type="File"指定输出到文件类型;
name ="file_info"指定target的名字;
fileName="${basedir}/Logs/NlogBlog_${level}_${shortdate}.txt"指定输出文件的具体名。
其中${basedir}的意思是程序所在的路径; ${level}的意思是日志的等级; ${shortdate}的意思是日期(具体到日)"
layout="${longdate} ${message}"指定输出文件内容的样式(可自由定义);
其中${longdate}的意思是日期(具体到毫秒),${message}是你具体要输出的内容。
-->
<target xsi:type="File" name ="file_info" fileName="${basedir}/Logs/NlogBuyLimit_${level}_${shortdate}.txt"
layout="${longdate} ${message}" encoding="UTF-8"/>
<target xsi:type="File" name ="file_info1" fileName="${basedir}/Logs/NlogBuyStop_${level}_${shortdate}.txt"
layout="${longdate} ${message}" encoding="UTF-8"/>
<target xsi:type="File" name ="file_info2" fileName="${basedir}/Logs/NlogSellLimit_${level}_${shortdate}.txt"
layout="${longdate} ${message}" encoding="UTF-8"/>
<target xsi:type="File" name ="file_info3" fileName="${basedir}/Logs/NlogSellStop_${level}_${shortdate}.txt"
layout="${longdate} ${message}" encoding="UTF-8"/>
<target xsi:type="File" name ="file_debug" fileName="${basedir}/Logs/NlogBlog_${level}_${shortdate}.txt"
layout="${longdate} ${message}" encoding="UTF-8"/>
<target xsi:type="File" name ="file_warn" fileName="${basedir}/Logs/NlogBlog_${level}_${shortdate}.txt"
layout="${longdate} ${message}" encoding="UTF-8"/>
<target xsi:type="File" name ="file_error" fileName="${basedir}/Logs/NlogBlog_${level}_${shortdate}.txt"
layout="${longdate} ${message}" encoding="UTF-8"/>
<target xsi:type="File" name ="file_trace" fileName="${basedir}/Logs/NlogBlog_${level}_${shortdate}.txt"
layout="${longdate} ${message}" encoding="UTF-8"/>
</targets>
<rules>
<!-- add your logging rules here -->
<!--
<logger name="*" minlevel="Trace" writeTo="f" />
-->
<logger name="A" levels="Info" writeTo="file_info"/>
<logger name="B" levels="Info" writeTo="file_info1"/>
<logger name="C" levels="Info" writeTo="file_info2"/>
<logger name="D" levels="Info" writeTo="file_info3"/>
<logger name="*" levels="Debug" writeTo="file_debug"/>
<logger name="*" levels="Warn" writeTo="file_warn"/>
<logger name="*" levels="Error" writeTo="file_error"/>
<logger name="*" levels="Trace" writeTo="file_trace"/>
</rules>
</nlog>
private static NLog.Logger BuyLimitLog = NLog.LogManager.GetLogger("A");