api log to elastic
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
|
||||
<PackageReference Include="Elastic.CommonSchema.Serilog" Version="8.6.1" />
|
||||
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.5.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.5" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.5">
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Elastic.CommonSchema.Serilog;
|
||||
using FluentValidation;
|
||||
using PARR.API.Installers;
|
||||
using PARR.BLL;
|
||||
@@ -9,9 +10,12 @@ var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Host.UseSerilog((context, config) =>
|
||||
{
|
||||
config
|
||||
.WriteTo.Console()
|
||||
.ReadFrom.Configuration(builder.Configuration);
|
||||
if (context.HostingEnvironment.IsProduction())
|
||||
config.WriteTo.Console(new EcsTextFormatter());
|
||||
else
|
||||
config.WriteTo.Console();
|
||||
|
||||
config.ReadFrom.Configuration(builder.Configuration);
|
||||
});
|
||||
|
||||
// Add services to the container.
|
||||
|
||||
@@ -5,6 +5,15 @@
|
||||
"Microsoft.AspNetCore": "Debug"
|
||||
}
|
||||
},
|
||||
"Serilog": {
|
||||
"MinimumLevel": {
|
||||
"Default": "Information",
|
||||
"Override": {
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
}
|
||||
},
|
||||
"StorageSettings": {
|
||||
"StoragePath": "W:\\"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user