mirror of https://github.com/abpframework/abp.git
4 changed files with 38 additions and 26 deletions
@ -1,21 +1,46 @@ |
|||||
using System.IO; |
using System; |
||||
|
using System.IO; |
||||
using Microsoft.AspNetCore.Hosting; |
using Microsoft.AspNetCore.Hosting; |
||||
|
using Serilog; |
||||
|
using Serilog.Events; |
||||
|
|
||||
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo |
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo |
||||
{ |
{ |
||||
public class Program |
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(); |
||||
|
} |
||||
} |
} |
||||
|
|
||||
public static IWebHost BuildWebHostInternal(string[] args) => |
internal static IWebHost BuildWebHostInternal(string[] args) => |
||||
new WebHostBuilder() |
new WebHostBuilder() |
||||
.UseKestrel() |
.UseKestrel() |
||||
.UseContentRoot(Directory.GetCurrentDirectory()) |
.UseContentRoot(Directory.GetCurrentDirectory()) |
||||
.UseIISIntegration() |
.UseIISIntegration() |
||||
.UseStartup<Startup>() |
.UseStartup<Startup>() |
||||
|
.UseSerilog() |
||||
.Build(); |
.Build(); |
||||
} |
} |
||||
} |
} |
||||
|
|||||
Loading…
Reference in new issue