refactor: Move log directory configuration to Application section
- Move LogDirectory from Logging section to Application section in appsettings.json - Update Program.cs to read from Application:LogDirectory instead of Logging:LogDirectory - Fix JSON schema validation warning for non-standard Logging properties - Application section now holds custom application-specific settings - Standard Logging and Serilog sections remain clean and schema-compliant
This commit is contained in:
@@ -19,8 +19,8 @@ var tempConfig = new ConfigurationBuilder()
|
||||
.Build();
|
||||
|
||||
// Get log directory from configuration
|
||||
var logDirectory = tempConfig.GetValue<string>("Logging:LogDirectory")
|
||||
?? throw new InvalidOperationException("Logging:LogDirectory not found in configuration.");
|
||||
var logDirectory = tempConfig.GetValue<string>("Application:LogDirectory")
|
||||
?? throw new InvalidOperationException("Application:LogDirectory not found in configuration.");
|
||||
var sqliteDbPath = Path.Combine(logDirectory, "logs.db");
|
||||
|
||||
Console.WriteLine($"[INFO] SQLite Log Database Path: {sqliteDbPath}");
|
||||
@@ -101,8 +101,8 @@ builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
|
||||
// Add Serilog.UI with SQLite provider - use same path from configuration
|
||||
var serilogUiLogDirectory = builder.Configuration.GetValue<string>("Logging:LogDirectory")
|
||||
?? throw new InvalidOperationException("Logging:LogDirectory not found in configuration.");
|
||||
var serilogUiLogDirectory = builder.Configuration.GetValue<string>("Application:LogDirectory")
|
||||
?? throw new InvalidOperationException("Application:LogDirectory not found in configuration.");
|
||||
var serilogUiDbPath = Path.Combine(serilogUiLogDirectory, "logs.db");
|
||||
|
||||
builder.Services.AddSerilogUi(logUIOpt =>
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
},
|
||||
"LogDirectory": "E:\\LogFiles\\Digital Data\\ECMJobRunner.WebCron"
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"SDD-VMP04-SQL17": "Server=SDD-VMP04-SQL17\\DD_DEVELOP01;Database=DD_ECM;User Id=sa;Password=dd;Encrypt=false;TrustServerCertificate=True;"
|
||||
@@ -18,5 +17,8 @@
|
||||
},
|
||||
"ReC": {
|
||||
"ApiUrl": "http://172.24.12.39:90"
|
||||
},
|
||||
"Application": {
|
||||
"LogDirectory": "E:\\LogFiles\\Digital Data\\ECMJobRunner.WebCron"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user