forked from MDCPS/DamageAssessment_Backend
added log changes to store in a file
This commit is contained in:
@ -24,8 +24,11 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="7.0.10" />
|
||||
<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.18.1" />
|
||||
<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" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.21.0" />
|
||||
</ItemGroup>
|
||||
|
@ -21,6 +21,11 @@ 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/UserAccess-{Date}.txt"); // Specify the file path and format
|
||||
});
|
||||
// Add services to the container.
|
||||
var authkey = builder.Configuration.GetValue<string>("JwtSettings:securitykey");
|
||||
var mode = builder.Configuration.GetValue<string>("ModeSettings:mode");
|
||||
|
Reference in New Issue
Block a user