perf: 优化启动配置

main
NoahLan 8 months ago
parent 0f6893d174
commit 3ff1c8620c

@ -11,18 +11,26 @@ Log.Logger = new LoggerConfiguration()
.MinimumLevel.Override("Quartz", LogEventLevel.Warning)
// 可使用{SourceContext}记录
.Enrich.FromLogContext()
.WriteTo.Async(c => c.File("logs/log-.txt", rollingInterval: RollingInterval.Day,
.WriteTo.Async(c => c.File("logs/all/log-.txt", rollingInterval: RollingInterval.Day,
restrictedToMinimumLevel: LogEventLevel.Debug))
.WriteTo.Async(c => c.File("logs/error-.txt", rollingInterval: RollingInterval.Day,
.WriteTo.Async(c => c.File("logs/error/error-.txt", rollingInterval: RollingInterval.Day,
restrictedToMinimumLevel: LogEventLevel.Error))
.WriteTo.Async(c => c.Console())
.CreateLogger();
try
{
Log.Information("""
_ _____ _ ____ __
/ |/ / _ \(_)__ / __/______ ___ _ ___ _ _____ ____/ /__
/ / ___/ / _ \/ _// __/ _ `/ ' \/ -_) |/|/ / _ \/ __/ '_/
/_/|_/_/ /_/_//_/_/ /_/ \_,_/_/_/_/\__/|__,__/\___/_/ /_/\_\
""");
Log.Information("NPin-Framework (Abp.vNext) 启动!");
var builder = WebApplication.CreateBuilder(args);
Log.Information($"当前主机启动环境-【{builder.Environment.EnvironmentName}】");
Log.Information($"当前主机启动地址-【{builder.Configuration["App:SelfUrl"]}】");
builder.WebHost.UseUrls(builder.Configuration["App:SelfUrl"]);
builder.Host.UseAutofac();
builder.Host.UseSerilog();

Loading…
Cancel
Save