From 3d5989e1ba0ea96038ceaa63a133ae572d0f29c5 Mon Sep 17 00:00:00 2001 From: Shreyas Zare Date: Sat, 15 Feb 2025 12:43:12 +0530 Subject: [PATCH] LogManager: updated UnhandledException case to always write error to console along with log file. --- DnsServerCore/LogManager.cs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/DnsServerCore/LogManager.cs b/DnsServerCore/LogManager.cs index fc61985e..af57f30d 100644 --- a/DnsServerCore/LogManager.cs +++ b/DnsServerCore/LogManager.cs @@ -1,6 +1,6 @@ /* Technitium DNS Server -Copyright (C) 2024 Shreyas Zare (shreyas@technitium.com) +Copyright (C) 2025 Shreyas Zare (shreyas@technitium.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -81,12 +81,10 @@ namespace DnsServerCore AppDomain.CurrentDomain.UnhandledException += delegate (object sender, UnhandledExceptionEventArgs e) { - if (!_enableLogging) - { - Console.WriteLine(e.ExceptionObject.ToString()); - return; - } + //log to console immediately + Console.WriteLine(e.ExceptionObject.ToString()); + //try log to file lock (_queueLock) { try @@ -103,7 +101,6 @@ namespace DnsServerCore { } catch (Exception ex) { - Console.WriteLine(e.ExceptionObject.ToString()); Console.WriteLine(ex.ToString()); } finally