|
|
|
@ -15,27 +15,38 @@ namespace IdentityServer |
|
|
|
{ |
|
|
|
public static int Main(string[] args) |
|
|
|
{ |
|
|
|
// Log.Logger = new LoggerConfiguration()
|
|
|
|
// .MinimumLevel.Debug()
|
|
|
|
// .MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
|
|
|
|
// .MinimumLevel.Override("Microsoft.Hosting.Lifetime", LogEventLevel.Information)
|
|
|
|
// .MinimumLevel.Override("System", LogEventLevel.Warning)
|
|
|
|
// .MinimumLevel.Override("Microsoft.AspNetCore.Authentication", LogEventLevel.Information)
|
|
|
|
// .Enrich.FromLogContext()
|
|
|
|
// // uncomment to write to Azure diagnostics stream
|
|
|
|
// //.WriteTo.File(
|
|
|
|
// // @"D:\home\LogFiles\Application\identityserver.txt",
|
|
|
|
// // fileSizeLimitBytes: 1_000_000,
|
|
|
|
// // rollOnFileSizeLimit: true,
|
|
|
|
// // shared: true,
|
|
|
|
// // flushToDiskInterval: TimeSpan.FromSeconds(1))
|
|
|
|
// .WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}", theme: AnsiConsoleTheme.Code)
|
|
|
|
// .CreateLogger();
|
|
|
|
Log.Logger = new LoggerConfiguration() |
|
|
|
.MinimumLevel.Debug() |
|
|
|
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning) |
|
|
|
.MinimumLevel.Override("Microsoft.Hosting.Lifetime", LogEventLevel.Information) |
|
|
|
.MinimumLevel.Override("System", LogEventLevel.Warning) |
|
|
|
.MinimumLevel.Override("Microsoft.AspNetCore.Authentication", LogEventLevel.Information) |
|
|
|
.Enrich.FromLogContext() |
|
|
|
// uncomment to write to Azure diagnostics stream
|
|
|
|
//.WriteTo.File(
|
|
|
|
// @"D:\home\LogFiles\Application\identityserver.txt",
|
|
|
|
// fileSizeLimitBytes: 1_000_000,
|
|
|
|
// rollOnFileSizeLimit: true,
|
|
|
|
// shared: true,
|
|
|
|
// flushToDiskInterval: TimeSpan.FromSeconds(1))
|
|
|
|
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}", theme: AnsiConsoleTheme.Code) |
|
|
|
.CreateLogger(); |
|
|
|
|
|
|
|
// Log.Information("Starting host...");
|
|
|
|
CreateHostBuilder(args).Build().Run(); |
|
|
|
return 0; |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
Log.Information("Starting host..."); |
|
|
|
CreateHostBuilder(args).Build().Run(); |
|
|
|
return 0; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
Log.Fatal(ex, "Host terminated unexpectedly."); |
|
|
|
return 1; |
|
|
|
} |
|
|
|
finally |
|
|
|
{ |
|
|
|
Log.CloseAndFlush(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public static IHostBuilder CreateHostBuilder(string[] args) => |
|
|
|
|