added log changes to store in a file

This commit is contained in:
Vijay Uppu
2024-01-23 15:21:59 -05:00
parent 947ee16281
commit 9b22249a89
18 changed files with 73 additions and 5 deletions

View File

@ -30,8 +30,11 @@
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.5" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="7.0.5" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Serilog.Extensions.Logging.File" Version="3.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
</ItemGroup>

View File

@ -19,7 +19,11 @@ const int intervalForCircuitBraker = 5; //5 seconds
builder.Services.AddCors(p => p.AddPolicy("DamageAppCorsPolicy", build => {
build.WithOrigins("*").AllowAnyMethod().AllowAnyHeader().AllowAnyOrigin();
}));
builder.Services.AddLogging(builder =>
{
//builder.AddConsole(); // Optional: Add other providers if needed
builder.AddFile("logs/Responses-{Date}.txt"); // Specify the file path and format
});
// Add services to the container.
var authkey = builder.Configuration.GetValue<string>("JwtSettings:securitykey");
builder.Services.AddAuthentication(item =>