nlog
<?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">
<!-- make sure to set 'Copy To Output Directory' option for this file -->
<!-- go to http://nlog-project.org/wiki/Configuration_file for more information -->
<targets>
<target name="DebugFile" xsi:type="File"
fileName="${basedir}/Logs/${shortdate}/${logger}.txt"
encoding="utf-8"
maxArchiveFiles="90"
maxArchiveDays="7"
archiveAbovesize="1024" 10240000为10M
layout="${longdate} | ${level:uppercase=true} | ${logger} | ${message} ${exception:format=tostring} ${newline}" />
<target name="DBLOGfile" xsi:type="File"
fileName="${basedir}/Logs/${shortdate}/${logger}.txt"
encoding="utf-8"
maxArchiveFiles="90"
layout="${longdate} | ${level:uppercase=true} | ${logger} | ${message} ${exception:format=tostring} ${newline}" />
</targets>
<rules>
<logger name="DBLOG" level="Info" writeTo="DBLOGfile" />
<logger name="DBLOG" level="Debug" writeTo="DBLOGfile" />
</rules>
</nlog>
private static Logger dblog = LoggerManager.GetLogger(“DBLOG”);