2012-02-05 16:53:08 +00:00
|
|
|
using System.Linq;
|
2012-02-16 05:14:01 +00:00
|
|
|
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()
|
|
|
|
{
|
2012-03-07 02:59:43 +00:00
|
|
|
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-16 05:14:01 +00:00
|
|
|
|
2012-02-05 16:53:08 +00:00
|
|
|
LogConfiguration.RegisterUdpLogger();
|
2012-02-16 05:14:01 +00:00
|
|
|
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-16 05:14:01 +00:00
|
|
|
|
2012-02-05 16:53:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|