Ejemplo n.º 1
0
        public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
        WebHost.CreateDefaultBuilder(args)
        .UseStartup <Startup>()
        .ConfigureLogging((hostingContext, logging) =>
        {
            var loggerConfiguration = new LoggerConfiguration()
                                      .MinimumLevel.Verbose()
                                      .Enrich.FromLogContext();
            loggerConfiguration.AddInformationToFile();
            loggerConfiguration.AddErrorToFile();
            if (!string.IsNullOrEmpty(hostingContext.Configuration["GELFLOGGER_HOST"]))
            {
                loggerConfiguration.AddToGrayLog(hostingContext.Configuration["GELFLOGGER_HOST"],
                                                 hostingContext.Configuration["LOGGER_UYGULAMAADI"],
                                                 hostingContext.Configuration["LOGGER_MODULADI"],
                                                 hostingContext.HostingEnvironment.EnvironmentName);
            }

            AddCommandLogToFile(loggerConfiguration, hostingContext.Configuration["ACTIVITY_PATH"]);
        });