Re: Stopping/Starting NLog on runtime?
Hey Boersnoes,
thanks for your answer, but this would change the config-file anyway, which isn't possible for me.
But after a deeper research in the sourcefiles I found a possibility:
if(chkLogger.Checked)
{
NLog.Config.SimpleConfigurator.ConfigureForFileLogging("Logfile.log", NLog.LogLevel.Trace);
}
else
{
NLog.Config.SimpleConfigurator.ConfigureForFileLogging("Logfile.log", NLog.LogLevel.Off);
}
This allows me to set the level during runtime and 'off' means no logging. Maybe I didn't make clear what I actually wanted ;)
The initial logging starts (or not) through the original config file, until the logging status is load and set.
|