2023-12-12 14:33:32 +08:00
|
|
|
|
using Serilog;
|
2023-12-12 17:16:28 +08:00
|
|
|
|
using Serilog.Events;
|
2023-12-11 09:55:12 +08:00
|
|
|
|
using Yi.Abp.Web;
|
|
|
|
|
|
|
2024-01-05 09:25:02 +08:00
|
|
|
|
//创建日志,可使用{SourceContext}记录
|
2023-12-12 14:33:32 +08:00
|
|
|
|
Log.Logger = new LoggerConfiguration()
|
2023-12-12 17:16:28 +08:00
|
|
|
|
.MinimumLevel.Debug()
|
|
|
|
|
|
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
|
|
|
|
|
|
.MinimumLevel.Override("Microsoft.AspNetCore.Hosting.Diagnostics",LogEventLevel.Error)
|
|
|
|
|
|
.MinimumLevel.Override("Quartz", LogEventLevel.Warning)
|
|
|
|
|
|
.Enrich.FromLogContext()
|
2023-12-22 18:57:04 +08:00
|
|
|
|
.WriteTo.Async(c => c.File("logs/log-.txt", rollingInterval: RollingInterval.Day))
|
2023-12-12 14:33:32 +08:00
|
|
|
|
.WriteTo.Async(c => c.Console())
|
|
|
|
|
|
.CreateLogger();
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2024-01-05 09:25:02 +08:00
|
|
|
|
Log.Information("Yi框架-Abp.vNext,启动!");
|
2023-12-12 14:33:32 +08:00
|
|
|
|
|
|
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
|
|
builder.WebHost.UseUrls(builder.Configuration["App:SelfUrl"]);
|
|
|
|
|
|
builder.Host.UseAutofac();
|
|
|
|
|
|
builder.Host.UseSerilog();
|
|
|
|
|
|
await builder.Services.AddApplicationAsync<YiAbpWebModule>();
|
|
|
|
|
|
var app = builder.Build();
|
|
|
|
|
|
await app.InitializeApplicationAsync();
|
|
|
|
|
|
await app.RunAsync();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
2024-01-05 09:25:02 +08:00
|
|
|
|
Log.Fatal(ex, "Yi框架-Abp.vNext,爆炸!");
|
2023-12-12 14:33:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
finally
|
|
|
|
|
|
{
|
|
|
|
|
|
Log.CloseAndFlush();
|
|
|
|
|
|
}
|