Radarr/NzbDrone.Services/NzbDrone.Services.Service/App_Start/Logging.cs

31 lines
1.0 KiB
C#
Raw Normal View History

2012-02-05 16:53:08 +00:00
using System.Linq;
using System.Web.Hosting;
2012-02-05 16:53:08 +00:00
using NLog;
using NzbDrone.Common;
using NzbDrone.Services.Service.App_Start;
[assembly: WebActivator.PreApplicationStartMethod(typeof(Logging), "PreStart")]
namespace NzbDrone.Services.Service.App_Start
{
public static class Logging
{
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
public static void PreStart()
{
string logPath = string.Format("C:\\NLog\\{0}\\{1}\\${{shortdate}}-${{logger}}.log", HostingEnvironment.SiteName, new EnvironmentProvider().Version);
string error = string.Format("C:\\NLog\\{0}\\{1}\\${{shortdate}}_Error.log", HostingEnvironment.SiteName, new EnvironmentProvider().Version);
2012-02-05 16:53:08 +00:00
LogConfiguration.RegisterUdpLogger();
LogConfiguration.RegisterFileLogger(logPath, LogLevel.Trace);
2012-02-16 06:30:48 +00:00
//LogConfiguration.RegisterFileLogger(error, LogLevel.Warn);
2012-02-05 16:53:08 +00:00
LogConfiguration.Reload();
logger.Info("Logger has been configured. (App Start)");
2012-02-05 16:53:08 +00:00
}
}
}