I'm trying to test NLog under LINQPad.
I successfully linked it and my code compiles well. However, NLog doesn't write log files because it is not configured.
I tried to make various config files like: NLog.config
and LINQPad.config
but it looks like I do not do it correctly.
My testing code under LINQPad is:
void Main()
{
try
{
int zero = 0;
int result = 5 / zero;
}
catch (DivideByZeroException ex)
{
Logger logger = LogManager.GetCurrentClassLogger();
logger.ErrorException("Whoops!", ex);
}
}
Config code:
<?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">
<targets>
<target name="logfile" xsi:type="File" fileName="logfile.log" />
</targets>
<rules>
<logger name="*" minlevel="Info" writeTo="logfile" />
</rules>
</nlog>
Where to put the config file?