Exemplo n.º 1
0
        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);

            LogConfiguration.RegisterUdpLogger();
            LogConfiguration.RegisterFileLogger(logPath, LogLevel.Trace);
            //LogConfiguration.RegisterFileLogger(error, LogLevel.Warn);
            LogConfiguration.Reload();

            logger.Info("Logger has been configured. (App Start)");
        }
Exemplo n.º 2
0
        private static void InitLoggers()
        {
            ReportingService.RestProvider = _container.Resolve <RestProvider>();

            LogConfiguration.RegisterConsoleLogger(LogLevel.Trace);
            LogConfiguration.RegisterUdpLogger();

            var logPath = Path.Combine(new EnvironmentProvider().GetSandboxLogFolder(), DateTime.Now.ToString("yyyy.MM.dd-H-mm") + ".txt");

            LogConfiguration.RegisterFileLogger(logPath, LogLevel.Info);

            LogConfiguration.Reload();
        }