I added NLog to my project. Following the instructions I created 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>
and then just log something.
var logger = LogManager.GetCurrentClassLogger();
logger.Info("xxxx");
With the developer web server it work fine, but when I publish the app to IIS, no logs are created.
See Question&Answers more detail:os