Update version and enhance logging configuration

- Bump `EnvelopeGenerator.Web` version to `3.1.3`.
- Improve logging setup in `Program.cs` with NLog and Trace level.
- Modify `ServiceContainer` to accept `MSSQLServer` parameter.
- Update `ModelContainer` to utilize new database service.
- Add `warningLogs` section in `appsettings.json` for logging.
- Streamline logging rules by consolidating level properties.
This commit is contained in:
Developer 02 2025-05-09 23:27:10 +02:00
parent ea6d80918c
commit 171de98552
4 changed files with 21 additions and 12 deletions

View File

@ -5,7 +5,7 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<PackageId>EnvelopeGenerator.Web</PackageId> <PackageId>EnvelopeGenerator.Web</PackageId>
<Version>3.1.2</Version> <Version>3.1.3</Version>
<Authors>Digital Data GmbH</Authors> <Authors>Digital Data GmbH</Authors>
<Company>Digital Data GmbH</Company> <Company>Digital Data GmbH</Company>
<Product>EnvelopeGenerator.Web</Product> <Product>EnvelopeGenerator.Web</Product>
@ -13,8 +13,8 @@
<PackageTags>digital data envelope generator web</PackageTags> <PackageTags>digital data envelope generator web</PackageTags>
<Description>EnvelopeGenerator.Web is an ASP.NET MVC application developed to manage signing processes. It uses Entity Framework Core (EF Core) for database operations. The user interface for signing processes is developed with Razor View Engine (.cshtml files) and JavaScript under wwwroot, integrated with PSPDFKit. This integration allows users to view and sign documents seamlessly.</Description> <Description>EnvelopeGenerator.Web is an ASP.NET MVC application developed to manage signing processes. It uses Entity Framework Core (EF Core) for database operations. The user interface for signing processes is developed with Razor View Engine (.cshtml files) and JavaScript under wwwroot, integrated with PSPDFKit. This integration allows users to view and sign documents seamlessly.</Description>
<ApplicationIcon>Assets\icon.ico</ApplicationIcon> <ApplicationIcon>Assets\icon.ico</ApplicationIcon>
<AssemblyVersion>3.1.2</AssemblyVersion> <AssemblyVersion>3.1.3</AssemblyVersion>
<FileVersion>3.1.2</FileVersion> <FileVersion>3.1.3</FileVersion>
<Copyright>Copyright © 2025 Digital Data GmbH. All rights reserved.</Copyright> <Copyright>Copyright © 2025 Digital Data GmbH. All rights reserved.</Copyright>
</PropertyGroup> </PropertyGroup>

View File

@ -24,6 +24,10 @@ try
{ {
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
builder.Logging.ClearProviders();
builder.Logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace);
builder.Host.UseNLog();
var config = builder.Configuration; var config = builder.Configuration;
var allowedOrigins = config.GetSection("AllowedOrigins").Get<string[]>() ?? var allowedOrigins = config.GetSection("AllowedOrigins").Get<string[]>() ??
@ -41,9 +45,6 @@ try
}); });
}); });
builder.Logging.ClearProviders();
builder.Host.UseNLog();
// Add base services // Add base services
builder.Services.AddScoped<DatabaseService>(); builder.Services.AddScoped<DatabaseService>();

View File

@ -18,9 +18,9 @@ namespace EnvelopeGenerator.Web.Services
public ActionService actionService; public ActionService actionService;
public EmailService emailService; public EmailService emailService;
public ServiceContainer(State state) public ServiceContainer(State state, MSSQLServer MSSQL)
{ {
actionService = new(state); actionService = new(state, MSSQL);
emailService = new(state); emailService = new(state);
} }
} }
@ -82,7 +82,7 @@ namespace EnvelopeGenerator.Web.Services
State.DbConfig = configModel.LoadConfiguration(); State.DbConfig = configModel.LoadConfiguration();
Models = new(State); Models = new(State);
Services = new(State); Services = new(State, MSSQL);
} }
else else
{ {

View File

@ -39,6 +39,11 @@
"fileName": "${logDirectory}\\${logFileNamePrefix}-Info.log", "fileName": "${logDirectory}\\${logFileNamePrefix}-Info.log",
"maxArchiveDays": 30 "maxArchiveDays": 30
}, },
"warningLogs": {
"type": "File",
"fileName": "${logDirectory}\\${logFileNamePrefix}-Warning.log",
"maxArchiveDays": 30
},
"errorLogs": { "errorLogs": {
"type": "File", "type": "File",
"fileName": "${logDirectory}\\${logFileNamePrefix}-Error.log", "fileName": "${logDirectory}\\${logFileNamePrefix}-Error.log",
@ -50,14 +55,17 @@
"maxArchiveDays": 30 "maxArchiveDays": 30
} }
}, },
// Trace, Debug, Info, Warn, Error and *Fatal*
"rules": [ "rules": [
{ {
"logger": "*", "logger": "*",
"minLevel": "Info", "level": "Info",
"maxLevel": "Warn",
"writeTo": "infoLogs" "writeTo": "infoLogs"
}, },
{
"logger": "*",
"level": "Warn",
"writeTo": "warningLogs"
},
{ {
"logger": "*", "logger": "*",
"level": "Error", "level": "Error",