Browse Source

日志

master
DESKTOP-G961P6V\Zhh 1 year ago
parent
commit
551c2388d5
  1. 3
      src/Shentun.WebPeis.Application/AppointPatientRegisters/AppointPatientRegisterAppService.cs
  2. 2
      src/Shentun.WebPeis.Domain/AppointPatientRegisters/AppointPatientRegisterManager.cs
  3. 8
      src/Shentun.WebPeis.HttpApi.Host/Program.cs
  4. 111
      src/Shentun.WebPeis.HttpApi.Host/Serilog.json
  5. 2
      src/Shentun.WebPeis.HttpApi.Host/Shentun.WebPeis.HttpApi.Host.csproj

3
src/Shentun.WebPeis.Application/AppointPatientRegisters/AppointPatientRegisterAppService.cs

@ -487,7 +487,8 @@ namespace Shentun.WebPeis.AppointPatientRegisters
patientRegisterDto.CustomerOrgName = customerOrgEntity.CustomerOrgName; patientRegisterDto.CustomerOrgName = customerOrgEntity.CustomerOrgName;
var appointPatientRegisters = await _repository.GetListAsync(o => o.PersonId == input.PersonId && var appointPatientRegisters = await _repository.GetListAsync(o => o.PersonId == input.PersonId &&
o.AppointDate >= DateTime.Now.Date && o.CustomerOrgRegisterId == patientRegisterDto.CustomerOrgRegisterId);
o.AppointDate >= DateTime.Now.Date && o.CustomerOrgRegisterId == patientRegisterDto.CustomerOrgRegisterId
&& o.CompleteFlag != AppointPatientRegisterCompleteFlag.CancelAppoint);
if (appointPatientRegisters .Any()) if (appointPatientRegisters .Any())
{ {
throw new UserFriendlyException("已有今天及之后的团检预约订单,必须先取消订单才能重新预约"); throw new UserFriendlyException("已有今天及之后的团检预约订单,必须先取消订单才能重新预约");

2
src/Shentun.WebPeis.Domain/AppointPatientRegisters/AppointPatientRegisterManager.cs

@ -238,7 +238,7 @@ namespace Shentun.WebPeis.AppointPatientRegisters
} }
var appoentPatientRegisters = await _repository.GetListAsync(o => o.PersonId == entity.PersonId && var appoentPatientRegisters = await _repository.GetListAsync(o => o.PersonId == entity.PersonId &&
o.AppointDate >= DateTime.Now.Date);
o.AppointDate >= DateTime.Now.Date && o.CompleteFlag != AppointPatientRegisterCompleteFlag.CancelAppoint);
if(appoentPatientRegisters.Count >= 1) if(appoentPatientRegisters.Count >= 1)
{ {
throw new UserFriendlyException("已有今天及之后的预约订单,必须先取消订单才能重新预约"); throw new UserFriendlyException("已有今天及之后的预约订单,必须先取消订单才能重新预约");

8
src/Shentun.WebPeis.HttpApi.Host/Program.cs

@ -2,10 +2,12 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Server.Kestrel.Core; using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Serilog; using Serilog;
using Serilog.Events; using Serilog.Events;
using Shentun.Utilities;
namespace Shentun.WebPeis; namespace Shentun.WebPeis;
@ -13,6 +15,11 @@ public class Program
{ {
public async static Task<int> Main(string[] args) public async static Task<int> Main(string[] args)
{ {
var configuration = new ConfigurationBuilder()
.SetBasePath(DirectoryHelper.GetAppDirectory())
.AddJsonFile("Serilog.json", false, reloadOnChange: true)
.Build();
Log.Logger = new LoggerConfiguration() Log.Logger = new LoggerConfiguration()
#if DEBUG #if DEBUG
.MinimumLevel.Debug() .MinimumLevel.Debug()
@ -24,6 +31,7 @@ public class Program
.Enrich.FromLogContext() .Enrich.FromLogContext()
.WriteTo.Async(c => c.File("Logs/logs.txt")) .WriteTo.Async(c => c.File("Logs/logs.txt"))
.WriteTo.Async(c => c.Console()) .WriteTo.Async(c => c.Console())
//.ReadFrom.Configuration(configuration)
.CreateLogger(); .CreateLogger();
try try

111
src/Shentun.WebPeis.HttpApi.Host/Serilog.json

@ -0,0 +1,111 @@
{
"Serilog": {
"Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File", "Serilog.Settings.Configuration", "Serilog.Sinks.PostgreSQL" ],
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Default": "Warning",
"System": "Warning",
"Microsoft": "Warning"
}
},
"Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ],
"WriteTo": [
{
"Name": "Console",
"Args": {
"restrictedToMinimumLevel": "Information",
"theme": "Serilog.Sinks.SystemConsole.Themes.SystemConsoleTheme::Literate, Serilog.Sinks.Console"
}
},
{
"Name": "File",
"Args": {
"path": "{CurrentDirectory}/logs/trace/trace-.log",
"rollingInterval": "Day",
"fileSizeLimitBytes": 52428800,
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{ThreadId} {Level:u3}] {Message:lj} {NewLine}{Exception}",
"restrictedToMinimumLevel": "Verbose"
}
},
{
"Name": "File",
"Args": {
"path": "{CurrentDirectory}/logs/debug/debug-.log",
"rollingInterval": "Day",
"fileSizeLimitBytes": 52428800,
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{ThreadId} {Level:u3}] {Message:lj} {NewLine}{Exception}",
"restrictedToMinimumLevel": "Debug"
}
},
{
"Name": "File",
"Args": {
"path": "{CurrentDirectory}/logs/info/info-.log",
"rollingInterval": "Day",
"fileSizeLimitBytes": 52428800,
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{ThreadId} {Level:u3}] {Message:lj} {NewLine}{Exception}",
"restrictedToMinimumLevel": "Information"
}
},
{
"Name": "File",
"Args": {
"path": "{CurrentDirectory}/logs/warning/warning-.log",
"rollingInterval": "Day",
"fileSizeLimitBytes": 52428800,
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{ThreadId} {Level:u3}] {Message:lj} {NewLine}{Exception}",
"restrictedToMinimumLevel": "Warning"
}
},
{
"Name": "PostgreSQL",
"Args": {
"connectionString": "Server=62.156.10.86;Port=5432;Database=WebPeis0520;User Id=postgres;Password=st123;",
"tableName": "logs",
"needAutoCreateTable": true,
//"columnOptionsSection": {
// "disableTriggers": true,
// "standardColumnOptions": {
// "additionalInformation": true,
// "properties": {
// "additionalInformation": true
// }
// }
//},
"restrictedToMinimumLevel": "Warning",
"batchPostingLimit": 100,
"period": "0.00:00:30",
"formatProvider": "Serilog.Sinks.PostgreSQL.ColumnWriterSettingsColumnWriterSettings, Serilog.Sinks.PostgreSQL"
}
},
{
"Name": "File",
"Args": {
"path": "{CurrentDirectory}/logs/fatal/fatal-.log",
"rollingInterval": "Day",
"fileSizeLimitBytes": 52428800,
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{ThreadId} {Level:u3}] {Message:lj} {NewLine}{Exception}",
"restrictedToMinimumLevel": "Fatal"
}
}
]
//"Filter": [
// {
// "Name": "With",
// "Args": {
// "filter": {
// "type": "SpaceNation.GameServer.Utility.Serilog.CustomFilter, spacenation.game.application.server",
// "levelFilter": "Verbose"
// }
// }
// }
//],
//"LogFilterKeys": [
// "Orleans",
// "Microsoft.AspNetCore",
// "Microsoft.Hosting",
// "Microsoft.Extensions"
//]
}
}

2
src/Shentun.WebPeis.HttpApi.Host/Shentun.WebPeis.HttpApi.Host.csproj

@ -13,6 +13,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Serilog.AspNetCore" Version="8.0.0" /> <PackageReference Include="Serilog.AspNetCore" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" /> <PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageReference Include="Serilog.Sinks.PostgreSQL" Version="2.3.0" />
<PackageReference Include="Volo.Abp.AspNetCore.MultiTenancy" Version="8.1.3" /> <PackageReference Include="Volo.Abp.AspNetCore.MultiTenancy" Version="8.1.3" />
<PackageReference Include="Volo.Abp.Autofac" Version="8.1.3" /> <PackageReference Include="Volo.Abp.Autofac" Version="8.1.3" />
<PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="8.1.3" /> <PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="8.1.3" />
@ -25,6 +26,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Shentun.Utilities\Shentun.Utilities.csproj" />
<ProjectReference Include="..\Shentun.WebApi.Service\Shentun.WebApi.Service.csproj" /> <ProjectReference Include="..\Shentun.WebApi.Service\Shentun.WebApi.Service.csproj" />
<ProjectReference Include="..\Shentun.WebPeis.Application\Shentun.WebPeis.Application.csproj" /> <ProjectReference Include="..\Shentun.WebPeis.Application\Shentun.WebPeis.Application.csproj" />
<ProjectReference Include="..\Shentun.WebPeis.EntityFrameworkCore\Shentun.WebPeis.EntityFrameworkCore.csproj" /> <ProjectReference Include="..\Shentun.WebPeis.EntityFrameworkCore\Shentun.WebPeis.EntityFrameworkCore.csproj" />

Loading…
Cancel
Save