|
@ -1,5 +1,4 @@ |
|
|
using System; |
|
|
using System; |
|
|
using System.IO; |
|
|
|
|
|
using Microsoft.AspNetCore.Hosting; |
|
|
using Microsoft.AspNetCore.Hosting; |
|
|
using Microsoft.Extensions.Configuration; |
|
|
using Microsoft.Extensions.Configuration; |
|
|
using Microsoft.Extensions.Hosting; |
|
|
using Microsoft.Extensions.Hosting; |
|
@ -13,20 +12,21 @@ public class Program |
|
|
{ |
|
|
{ |
|
|
var configuration = new ConfigurationBuilder() |
|
|
var configuration = new ConfigurationBuilder() |
|
|
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) |
|
|
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) |
|
|
.AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", optional: true, reloadOnChange: true); |
|
|
.AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", optional: true, reloadOnChange: true) |
|
|
|
|
|
.Build(); |
|
|
|
|
|
|
|
|
Log.Logger = new LoggerConfiguration() |
|
|
Log.Logger = new LoggerConfiguration() |
|
|
.WriteTo.Async(c => c.File(Path.Combine(Directory.GetCurrentDirectory(), "../Logs/logs.txt") |
|
|
.WriteTo.Async(c => c.Console()) |
|
|
|
|
|
.WriteTo.Async(c => c.File("Logs/logs.txt" |
|
|
, rollingInterval: RollingInterval.Day |
|
|
, rollingInterval: RollingInterval.Day |
|
|
, rollOnFileSizeLimit: true |
|
|
, rollOnFileSizeLimit: true |
|
|
, fileSizeLimitBytes: 30 * 1024 * 1024)) |
|
|
, fileSizeLimitBytes: 30 * 1024 * 1024)) |
|
|
.WriteTo.Async(c => c.Console()) |
|
|
|
|
|
.CreateLogger(); |
|
|
.CreateLogger(); |
|
|
|
|
|
|
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
Log.Information("Starting web host."); |
|
|
Log.Information("Starting web host."); |
|
|
CreateHostBuilder(args).Build().Run(); |
|
|
CreateHostBuilder(args).UseSerilog().Build().Run(); |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
catch (Exception ex) |
|
|
catch (Exception ex) |
|
|