Browse Source

[fix]启用数据库日志

master
贾荣国 3 years ago
parent
commit
6c4c8ee887
  1. 28
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/Program.cs
  2. 4
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/Win_in.Sfs.Scp.WebApi.HttpApi.Host.csproj

28
WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/Program.cs

@ -16,22 +16,22 @@ namespace Win_in.Sfs.Scp.WebApi
.AddJsonFile("appsettings.json", false, true)
.Build();
// Log.Logger = new LoggerConfiguration()
// .ReadFrom.Configuration(configuration)
// .CreateLogger();
Log.Logger = new LoggerConfiguration()
#if DEBUG
.MinimumLevel.Debug()
#else
.MinimumLevel.Information()
#endif
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
.Enrich.FromLogContext()
.WriteTo.Async(c => c.File("Logs/logs.txt",rollingInterval:RollingInterval.Day))
.WriteTo.Async(c => c.Console())
.ReadFrom.Configuration(configuration)
.CreateLogger();
//
// Log.Logger = new LoggerConfiguration()
// #if DEBUG
// .MinimumLevel.Debug()
// #else
// .MinimumLevel.Information()
// #endif
// .MinimumLevel.Override("Microsoft", LogEventLevel.Information)
// .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
// .Enrich.FromLogContext()
// .WriteTo.Async(c => c.File("Logs/logs.txt",rollingInterval:RollingInterval.Day))
// .WriteTo.Async(c => c.Console())
// .CreateLogger();
try
{

4
WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/Win_in.Sfs.Scp.WebApi.HttpApi.Host.csproj

@ -7,8 +7,8 @@
<RootNamespace>Win_in.Sfs.Scp.WebApi</RootNamespace>
<PreserveCompilationReferences>true</PreserveCompilationReferences>
<UserSecretsId>Win_in.Sfs.Scp.WebApi-4681b4fd-151f-4221-84a4-929d86723e4c</UserSecretsId>
<AssemblyVersion>1.22.0525.1</AssemblyVersion>
<FileVersion>1.22.0525.1</FileVersion>
<AssemblyVersion>1.22.0601.1</AssemblyVersion>
<FileVersion>1.22.0601.1</FileVersion>
</PropertyGroup>
<ItemGroup>

Loading…
Cancel
Save