mirror of
https://github.com/fergalmoran/DnsServer.git
synced 2025-12-22 09:29:50 +00:00
LogManager: updated UnhandledException case to always write error to console along with log file.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Technitium DNS Server
|
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
|
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
|
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)
|
AppDomain.CurrentDomain.UnhandledException += delegate (object sender, UnhandledExceptionEventArgs e)
|
||||||
{
|
{
|
||||||
if (!_enableLogging)
|
//log to console immediately
|
||||||
{
|
|
||||||
Console.WriteLine(e.ExceptionObject.ToString());
|
Console.WriteLine(e.ExceptionObject.ToString());
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
//try log to file
|
||||||
lock (_queueLock)
|
lock (_queueLock)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -103,7 +101,6 @@ namespace DnsServerCore
|
|||||||
{ }
|
{ }
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine(e.ExceptionObject.ToString());
|
|
||||||
Console.WriteLine(ex.ToString());
|
Console.WriteLine(ex.ToString());
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|||||||
Reference in New Issue
Block a user