Browse Source

wms接口添加分天记录日志功能

dev_DY_CC
lvzb 10 months ago
parent
commit
2fa7d89c7a
  1. 2
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/TyrpAgentModule.cs
  2. 2
      be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/AgentModule.cs
  3. 28
      be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/Program.cs
  4. 2
      be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/Win_in.Sfs.Wms.DataExchange.Agent.csproj
  5. 39
      be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/serilogsettings.json

2
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/TyrpAgentModule.cs

@ -173,7 +173,7 @@ public class TyrpAgentModule : AbpModule
{
context.AddBackgroundWorkerAsync<TyrpIncomingBackgroundWorker>();
context.AddBackgroundWorkerAsync<TyrpOutgoingBackgroundWorker>();
//context.AddBackgroundWorkerAsync<TyrpOutgoingBackgroundWorker>();
}
}

2
be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/AgentModule.cs

@ -150,6 +150,6 @@ public class AgentModule : AbpModule
ApplicationInitializationContext context)
{
context.AddBackgroundWorkerAsync<IncomingToWmsWorker>();
context.AddBackgroundWorkerAsync<OutgoingFromWmsWorker>();
// context.AddBackgroundWorkerAsync<OutgoingFromWmsWorker>();
}
}

28
be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/Program.cs

@ -1,5 +1,6 @@
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Serilog;
@ -11,18 +12,25 @@ public class Program
{
public static async Task<int> Main(string[] args)
{
// Log.Logger = new LoggerConfiguration()
//#if DEBUG
// .MinimumLevel.Debug()
//#else
// .MinimumLevel.Information()
//#endif
// .MinimumLevel.Override("Microsoft", LogEventLevel.Information)
// .Enrich.FromLogContext()
// .WriteTo.Async(c => c.File("Logs/logs.txt"))
// .WriteTo.Async(c => c.Console())
// .CreateLogger();
IConfigurationRoot configuration =
new ConfigurationBuilder()
.AddJsonFile("serilogsettings.json", false, true)
.Build();
Log.Logger = new LoggerConfiguration()
#if DEBUG
.MinimumLevel.Debug()
#else
.MinimumLevel.Information()
#endif
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.Enrich.FromLogContext()
.WriteTo.Async(c => c.File("Logs/logs.txt"))
.WriteTo.Async(c => c.Console())
.ReadFrom.Configuration(configuration)
.CreateLogger();
try
{
Log.Information("Starting console host.");

2
be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/Win_in.Sfs.Wms.DataExchange.Agent.csproj

@ -11,10 +11,12 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.12" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.*" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="6.0.12" />
<PackageReference Include="Serilog.AspNetCore" Version="6.1.0" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="5.0.1" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.MSSqlServer" Version="6.3.0" />
<PackageReference Include="Volo.Abp.Autofac" Version="6.0.2" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="5.3.5" />
<PackageReference Include="Volo.Abp.BackgroundJobs" Version="5.3.5" />

39
be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/serilogsettings.json

@ -0,0 +1,39 @@
{
"Serilog": {
"Using": [ "Serilog.Sinks.File", "Serilog.Sinks.Async", "Serilog.Sinks.Console", "Serilog.Sinks.MSSqlServer" ],
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Information",
"Microsoft.EntityFrameworkCore": "Warning"
}
},
"WriteTo": [
{
"Name": "Async",
"Args": {
"configure": [
{
"Name": "File",
"Args": {
"path": "..//Logs//WmsAgent//WmsAgent_.log",
"rollingInterval": "Day",
"fileSizeLimitBytes": "52428800",
"rollOnFileSizeLimit": "true",
"restrictedToMinimumLevel": "Debug"
}
}
]
}
},
{
"Name": "Console",
"Args": {
"restrictedToMinimumLevel": "Debug",
"outputTemplate": "{Timestamp:HH:mm:ss.fff} [{Level:u3}] {Message} {NewLine}{Exception}"
}
}
],
"Enrich": [ "FromLogContext", "WithMachineName", "WithProcessId", "WithThreadId" ]
}
}
Loading…
Cancel
Save