This commit is contained in:
Кашин Максим 2022-11-29 10:43:42 +04:00
parent b6ae2985c9
commit d78e351907
3 changed files with 14 additions and 6 deletions

View File

@ -14,7 +14,7 @@
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.1.0" /> <PackageReference Include="NLog.Extensions.Logging" Version="5.2.0" />
<PackageReference Include="Serilog" Version="2.12.0" /> <PackageReference Include="Serilog" Version="2.12.0" />
<PackageReference Include="Serilog.AspNetCore" Version="6.0.1" /> <PackageReference Include="Serilog.AspNetCore" Version="6.0.1" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="5.0.1" /> <PackageReference Include="Serilog.Extensions.Hosting" Version="5.0.1" />

View File

@ -30,7 +30,7 @@ namespace GasolineTanker
{ {
var configuration = new ConfigurationBuilder() var configuration = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory()) .SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile(path: "C:\\Users\\Ìàêñèì\\Desktop\\Óíèâåð\\3 ñåìåñòð\\ÐÏÏ\\GasolineTanker\\GasolineTanker\\GasolineTanker\\appSetting.json", optional: false, reloadOnChange: true) .AddJsonFile(path: "C:\\Users\\kashi\\Desktop\\RPP\\GasolineTankerBase\\Base\\GasolineTanker\\GasolineTanker\\appSetting.json", optional: false, reloadOnChange: true)
.Build(); .Build();
var logger = new LoggerConfiguration() var logger = new LoggerConfiguration()

View File

@ -1,12 +1,20 @@
{ {
"Serilog": { "Serilog": {
"Using": [ "Serilog.Sinks.File" ], "Using": [ "Serilog.Sinks.File" ],
"MinimumLevel": "Debug", "MinimumLevel": "Information",
"WriteTo": [ "WriteTo": [
{ {
"Name": "File", "Name": "File",
"Args": { "path": "C:\\Университет\\2 курс\\РПП\\AntiAircraftGun\\AntiAircraftGun\\AntiAircraftGun\\bin\\Debug\\net6.0-windows\\Log.txt" } "Args": {
} "path": "Logs/log_.log",
] "rollingInterval": "Day",
"outputTemplate": "[{Timestamp:HH:mm:ss.fff}]{Level:u4}: {Message:lj}{NewLine}{Exception}"
}
}
],
"Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ],
"Properties": {
"Application": "GasolineTanker"
}
} }
} }