我已将NLog添加到我的项目中。按照说明,我创建了NLog.config。
<?xml version="1.0" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="file" xsi:type="File"
layout="${longdate} ${logger} ${message}"
fileName="${basedir}/${shortdate}.log" />
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="file" />
</rules>
</nlog>
然后只记录一些内容。
var logger = LogManager.GetCurrentClassLogger();
logger.Info("xxxx");
使用开发人员Web服务器,它可以正常工作,但是当我将应用程序发布到IIS时,不会创建任何日志。