feat: Logging für unerwartete Ausnahmen hinzugefügt, um eine bessere Fehlerverfolgung und Problemlösung zu gewährleisten.

This commit is contained in:
Developer 02 2025-03-10 15:42:22 +01:00
parent d108978b63
commit cbd3accf72

View File

@ -6,6 +6,8 @@ using Ocelot.Middleware;
var logger = LogManager.Setup().LoadConfigurationFromAppSettings().GetCurrentClassLogger(); var logger = LogManager.Setup().LoadConfigurationFromAppSettings().GetCurrentClassLogger();
logger.Info("Logging initialized."); logger.Info("Logging initialized.");
try
{
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
// Make sure to add the Ocelot configuration file // Make sure to add the Ocelot configuration file
@ -30,3 +32,10 @@ app.UseEndpoints(endpoints =>
app.UseOcelot().Wait(); app.UseOcelot().Wait();
app.Run(); app.Run();
}
catch(Exception ex)
{
logger.Error(ex, "Stopped program because of exception.");
throw;
}