aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Barron <barronpm@gmail.com>2023-09-22 09:50:29 -0400
committerPatrick Barron <barronpm@gmail.com>2023-09-22 10:16:52 -0400
commit1d8c3e088be75ce02b811afaeea20307df0487be (patch)
treee9608533660910c6941f7579f4a61857e6885132
parent3a2799e61b3aa1fcda0d06531d455944e78c581c (diff)
Don't log unhandled exceptions twice
-rw-r--r--Jellyfin.Server/Program.cs9
1 files changed, 1 insertions, 8 deletions
diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs
index 6e8b17a73..3a3dd97bd 100644
--- a/Jellyfin.Server/Program.cs
+++ b/Jellyfin.Server/Program.cs
@@ -89,12 +89,6 @@ namespace Jellyfin.Server
private static async Task StartApp(StartupOptions options)
{
_startTimestamp = Stopwatch.GetTimestamp();
-
- // Log all uncaught exceptions to std error
- static void UnhandledExceptionToConsole(object sender, UnhandledExceptionEventArgs e) =>
- Console.Error.WriteLine("Unhandled Exception\n" + e.ExceptionObject);
- AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionToConsole;
-
ServerApplicationPaths appPaths = StartupHelpers.CreateApplicationPaths(options);
// $JELLYFIN_LOG_DIR needs to be set for the logger configuration manager
@@ -112,8 +106,7 @@ namespace Jellyfin.Server
StartupHelpers.InitializeLoggingFramework(startupConfig, appPaths);
_logger = _loggerFactory.CreateLogger("Main");
- // Log uncaught exceptions to the logging instead of std error
- AppDomain.CurrentDomain.UnhandledException -= UnhandledExceptionToConsole;
+ // Use the logging framework for uncaught exceptions instead of std error
AppDomain.CurrentDomain.UnhandledException += (_, e)
=> _logger.LogCritical((Exception)e.ExceptionObject, "Unhandled Exception");