通過NuGet的Console方式
PM> Install-Package NLog
或者直接用Manage
%201%20<?xml%20version="1.0"%20encoding="utf-8"%20?>%202%20<configuration>%203%20%20%20<configSections>%204%20%20%20%20%20<section%20name="nlog"%20type="NLog.Config.ConfigSectionHandler,%20NLog"/>%205%20%20%20</configSections>%206%20%20%20<nlog%20xmlns="http://www.nlog-相關介紹鏈接
http://nlog-project.org/
https://github.com/nlog/nlog/wiki/Configuration-file
http://www.companysz.com/dflying/archive/2006/12/06/584426.html(翻譯版)
常用配置(異常和信息記錄分類按日期保存):
<configSections> <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/> </configSections> <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <targets> <target name="fileError" xsi:type="File" fileName="logs/Error/${shortdate}.txt" layout="${date:format=HH/:mm/:ss}-${stacktrace}-${message}"/> <target name="fileInfo" xsi:type="File" fileName="logs/Info/${shortdate}.txt" layout="${date:format=HH/:mm/:ss}-${message}"/> </targets> <rules> <logger name="*" levels="Error" writeTo="fileError"/> <logger name="*" levels="Info" writeTo="fileInfo"/> </rules> </nlog>
新聞熱點
疑難解答