feat(configmanager): add Serilog file logging to UI and create README
Configure Serilog for the ConfigManager UI application, replacing console logging with daily rolling file logs in logs/ directory with 30-day retention. Add shutdown handler to flush logs on exit.
This commit is contained in:
@@ -7,7 +7,8 @@ using JdeScoping.ConfigManager.Core.DependencyInjection;
|
||||
using JdeScoping.ConfigManager.Ui.Services;
|
||||
using JdeScoping.ConfigManager.Ui.ViewModels;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Serilog;
|
||||
using Serilog.Events;
|
||||
|
||||
namespace JdeScoping.ConfigManager.Ui;
|
||||
|
||||
@@ -37,6 +38,9 @@ public partial class App : Avalonia.Application
|
||||
{
|
||||
DataContext = Services.GetRequiredService<MainWindowViewModel>()
|
||||
};
|
||||
|
||||
// Ensure logs are flushed on exit
|
||||
desktop.ShutdownRequested += (_, _) => Log.CloseAndFlush();
|
||||
}
|
||||
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
@@ -44,10 +48,24 @@ public partial class App : Avalonia.Application
|
||||
|
||||
private void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
// Configure Serilog with daily rolling file
|
||||
var logsPath = Path.Combine(AppContext.BaseDirectory, "logs");
|
||||
Directory.CreateDirectory(logsPath);
|
||||
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.MinimumLevel.Information()
|
||||
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
|
||||
.MinimumLevel.Override("Avalonia", LogEventLevel.Warning)
|
||||
.Enrich.FromLogContext()
|
||||
.WriteTo.File(
|
||||
path: Path.Combine(logsPath, "configmanager-.log"),
|
||||
rollingInterval: RollingInterval.Day,
|
||||
retainedFileCountLimit: 30,
|
||||
outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}{Exception}")
|
||||
.CreateLogger();
|
||||
|
||||
// Logging
|
||||
services.AddLogging(builder => builder
|
||||
.AddConsole()
|
||||
.SetMinimumLevel(LogLevel.Debug));
|
||||
services.AddLogging(builder => builder.AddSerilog(dispose: true));
|
||||
|
||||
// Add all ConfigManager.Core services
|
||||
services.AddConfigManagerCore();
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
# JdeScoping ConfigManager UI
|
||||
|
||||
Graphical configuration management tool for JDE Scoping Tool settings.
|
||||
|
||||
## Building
|
||||
|
||||
```bash
|
||||
dotnet build NEW/src/Utils/JdeScoping.ConfigManager.Ui/JdeScoping.ConfigManager.Ui.csproj
|
||||
```
|
||||
|
||||
## Running
|
||||
|
||||
```bash
|
||||
dotnet run --project NEW/src/Utils/JdeScoping.ConfigManager.Ui/JdeScoping.ConfigManager.Ui.csproj
|
||||
```
|
||||
|
||||
Or run the built executable directly.
|
||||
|
||||
## Configuration Discovery
|
||||
|
||||
The UI searches for configuration in this order:
|
||||
1. `JDESCOPING_CONFIG_PATH` environment variable
|
||||
2. Same directory as executable
|
||||
3. `../JdeScoping.Host/` relative to executable
|
||||
4. User config directory
|
||||
|
||||
## Features
|
||||
|
||||
### Configuration Sections
|
||||
- **Data Sync** - Sync intervals and behavior
|
||||
- **Data Access** - Batch sizes and timeouts
|
||||
- **Authentication** - Session settings
|
||||
- **LDAP** - Directory server configuration
|
||||
- **Search** - Search behavior settings
|
||||
- **Excel Export** - Export format options
|
||||
- **Connection Strings** - Database connections (with provider-specific forms)
|
||||
|
||||
### Pipeline Editor
|
||||
- Visual pipeline flow editor
|
||||
- Pre-script / Post-script management
|
||||
- Transform configuration (ColumnDrop, ColumnRename, JdeDate, Regex)
|
||||
- Source and destination editing
|
||||
- Reorder steps via move up/down
|
||||
|
||||
### Secret Management
|
||||
- SecureStore initialization
|
||||
- View, add, edit, remove secrets
|
||||
- Copy secret values to clipboard
|
||||
|
||||
### Validation
|
||||
- appsettings.json validation
|
||||
- Pipeline configuration validation
|
||||
- Results displayed in dialog
|
||||
|
||||
## Logging
|
||||
|
||||
Logs are written to the `logs/` directory relative to the executable:
|
||||
- **Location:** `logs/configmanager-YYYYMMDD.log`
|
||||
- **Rotation:** Daily with 30-day retention
|
||||
- **Level:** Information (warnings and errors from framework components)
|
||||
|
||||
## CLI Alternative
|
||||
|
||||
For command-line usage, see the [ConfigManager CLI](../JdeScoping.ConfigManager.Cli/README.md).
|
||||
Reference in New Issue
Block a user