|
|
|
@ -1,13 +1,37 @@ |
|
|
|
using System.IO; |
|
|
|
using System; |
|
|
|
using System.IO; |
|
|
|
using Microsoft.AspNetCore.Hosting; |
|
|
|
using Serilog; |
|
|
|
using Serilog.Events; |
|
|
|
|
|
|
|
namespace Volo.AbpWebSite |
|
|
|
{ |
|
|
|
public class Program |
|
|
|
{ |
|
|
|
public static void Main(string[] args) |
|
|
|
public static int Main(string[] args) |
|
|
|
{ |
|
|
|
BuildWebHostInternal(args).Run(); |
|
|
|
Log.Logger = new LoggerConfiguration() |
|
|
|
.MinimumLevel.Debug() //TODO: Should be configurable!
|
|
|
|
.MinimumLevel.Override("Microsoft", LogEventLevel.Information) |
|
|
|
.Enrich.FromLogContext() |
|
|
|
.WriteTo.File("Logs/logs.txt") |
|
|
|
.CreateLogger(); |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
Log.Information("Starting web host."); |
|
|
|
BuildWebHostInternal(args).Run(); |
|
|
|
return 0; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
Log.Fatal(ex, "Host terminated unexpectedly!"); |
|
|
|
return 1; |
|
|
|
} |
|
|
|
finally |
|
|
|
{ |
|
|
|
Log.CloseAndFlush(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
internal static IWebHost BuildWebHostInternal(string[] args) => |
|
|
|
@ -16,6 +40,7 @@ namespace Volo.AbpWebSite |
|
|
|
.UseContentRoot(Directory.GetCurrentDirectory()) |
|
|
|
.UseIISIntegration() |
|
|
|
.UseStartup<Startup>() |
|
|
|
.UseSerilog() |
|
|
|
.Build(); |
|
|
|
} |
|
|
|
} |
|
|
|
|