feat: 添加日志组件
This commit is contained in:
@@ -1,9 +1,30 @@
|
||||
using Serilog;
|
||||
using Yi.Abp.Web;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.WebHost.UseUrls(builder.Configuration["App:SelfUrl"]);
|
||||
builder.Host.UseAutofac();
|
||||
await builder.Services.AddApplicationAsync<YiAbpWebModule>();
|
||||
var app = builder.Build();
|
||||
await app.InitializeApplicationAsync();
|
||||
await app.RunAsync();
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.WriteTo.Async(c => c.File("Logs/logs.txt", rollingInterval: RollingInterval.Day))
|
||||
.WriteTo.Async(c => c.Console())
|
||||
.CreateLogger();
|
||||
|
||||
try
|
||||
{
|
||||
Log.Information("Yi<59><69><EFBFBD><EFBFBD>-Abp.vNext<78><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
|
||||
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)
|
||||
{
|
||||
Log.Fatal(ex, "Yi<59><69><EFBFBD><EFBFBD>-Abp.vNext<78><74><EFBFBD><EFBFBD>ը<EFBFBD><D5A8>");
|
||||
}
|
||||
finally
|
||||
{
|
||||
Log.CloseAndFlush();
|
||||
}
|
||||
Reference in New Issue
Block a user