added log changes to store in a file
This commit is contained in:
parent
947ee16281
commit
9b22249a89
@ -19,7 +19,10 @@
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.9" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.9" />
|
||||
<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="Serilog.Extensions.Logging.File" Version="3.0.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -31,6 +31,11 @@ builder.Services.AddAuthentication(item =>
|
||||
ClockSkew = TimeSpan.Zero
|
||||
};
|
||||
});
|
||||
builder.Services.AddLogging(builder =>
|
||||
{
|
||||
//builder.AddConsole(); // Optional: Add other providers if needed
|
||||
builder.AddFile("logs/answers-{Date}.txt"); // Specify the file path and format
|
||||
});
|
||||
// Add services to the container.
|
||||
|
||||
builder.Services.AddControllers();
|
||||
|
@ -27,7 +27,10 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<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="Serilog.Extensions.Logging.File" Version="3.0.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using System.Reflection;
|
||||
@ -15,7 +16,11 @@ builder.Services.AddCors(p => p.AddPolicy("DamageAppCorsPolicy", build => {
|
||||
build.WithOrigins("*").AllowAnyMethod().AllowAnyHeader().AllowAnyOrigin();
|
||||
}));
|
||||
var authkey = builder.Configuration.GetValue<string>("JwtSettings:securitykey");
|
||||
|
||||
builder.Services.AddLogging(builder =>
|
||||
{
|
||||
//builder.AddConsole(); // Optional: Add other providers if needed
|
||||
builder.AddFile("logs/attachments-{Date}.txt"); // Specify the file path and format
|
||||
});
|
||||
builder.Services.AddAuthentication(item =>
|
||||
{
|
||||
item.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
|
@ -25,7 +25,10 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<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="Serilog.Extensions.Logging.File" Version="3.0.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -14,7 +14,11 @@ builder.Services.AddCors(p => p.AddPolicy("DamageAppCorsPolicy", build => {
|
||||
}));
|
||||
// Add services to the container.
|
||||
var authkey = builder.Configuration.GetValue<string>("JwtSettings:securitykey");
|
||||
|
||||
builder.Services.AddLogging(builder =>
|
||||
{
|
||||
//builder.AddConsole(); // Optional: Add other providers if needed
|
||||
builder.AddFile("logs/DocuLinks-{Date}.txt"); // Specify the file path and format
|
||||
});
|
||||
builder.Services.AddAuthentication(item =>
|
||||
{
|
||||
item.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
|
@ -24,7 +24,10 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<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="Serilog.Extensions.Logging.File" Version="3.0.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -14,7 +14,11 @@ builder.Services.AddCors(p => p.AddPolicy("DamageAppCorsPolicy", build => {
|
||||
}));
|
||||
// Add services to the container.
|
||||
var authkey = builder.Configuration.GetValue<string>("JwtSettings:securitykey");
|
||||
|
||||
builder.Services.AddLogging(builder =>
|
||||
{
|
||||
//builder.AddConsole(); // Optional: Add other providers if needed
|
||||
builder.AddFile("logs/Employees-{Date}.txt"); // Specify the file path and format
|
||||
});
|
||||
builder.Services.AddAuthentication(item =>
|
||||
{
|
||||
item.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
|
@ -25,7 +25,10 @@
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.21" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.5" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" 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="Serilog.Extensions.Logging.File" Version="3.0.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -14,7 +14,11 @@ builder.Services.AddCors(p => p.AddPolicy("DamageAppCorsPolicy", build => {
|
||||
}));
|
||||
// Add services to the container.
|
||||
var authkey = builder.Configuration.GetValue<string>("JwtSettings:securitykey");
|
||||
|
||||
builder.Services.AddLogging(builder =>
|
||||
{
|
||||
//builder.AddConsole(); // Optional: Add other providers if needed
|
||||
builder.AddFile("logs/Locations-{Date}.txt"); // Specify the file path and format
|
||||
});
|
||||
builder.Services.AddAuthentication(item =>
|
||||
{
|
||||
item.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
|
@ -25,7 +25,10 @@
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.21" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.5" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" 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="Serilog.Extensions.Logging.File" Version="3.0.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -12,6 +12,11 @@ var builder = WebApplication.CreateBuilder(args);
|
||||
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/Questions-{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 =>
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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 =>
|
||||
|
@ -25,7 +25,10 @@
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.21" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.5" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" 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="Serilog.Extensions.Logging.File" Version="3.0.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -12,6 +12,11 @@ var builder = WebApplication.CreateBuilder(args);
|
||||
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/Surveys-{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 =>
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user