mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 10:47:08 -07:00
Nzbdrone.exe file logging
This commit is contained in:
parent
d3f6c685cd
commit
9be08b810e
4 changed files with 42 additions and 12 deletions
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using NLog;
|
||||
using NLog.Config;
|
||||
using NLog.Targets;
|
||||
|
@ -74,6 +75,20 @@ namespace NzbDrone.Common
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public static void RegisterFileLogger(string fileName)
|
||||
{
|
||||
var fileTarget = new FileTarget();
|
||||
fileTarget.AutoFlush = true;
|
||||
fileTarget.ConcurrentWrites = false;
|
||||
fileTarget.FileName = fileName;
|
||||
fileTarget.KeepFileOpen = false;
|
||||
fileTarget.Layout = "${longdate} - ${logger}: ${message} ${exception:format=ToString}";
|
||||
|
||||
LogManager.Configuration.AddTarget(fileTarget.GetType().Name, fileTarget);
|
||||
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, fileTarget));
|
||||
}
|
||||
|
||||
public static void RegisterExceptioneer()
|
||||
{
|
||||
if (EnviromentProvider.IsProduction)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue