Updated NLog exception logging format to capture all details

Updated the NLog exception handling to make use of the additional logging options released recently. This will help provide me with more details when users create the Support ZIP File.
This commit is contained in:
Terry MacDonald 2022-06-28 13:47:56 +12:00
parent 895a6d4e10
commit e99db6d4af
3 changed files with 5 additions and 5 deletions

View File

@ -262,7 +262,7 @@ namespace DisplayMagician {
{
FileName = AppLogFilename,
DeleteOldFileOnStartup = true,
Layout = "${longdate}|${level:uppercase=true}|${logger}|${message}${onexception:EXCEPTION OCCURRED\\:${exception:format=type,message,method:maxInnerExceptionLevel=5:innerFormat=shortType,message,method}}"
Layout = "${longdate}|${level:uppercase=true}|${logger}|${message}|${onexception:EXCEPTION OCCURRED \\:${exception::format=toString,Properties,Data}"
};
// Create a logging rule to use the log file target
@ -275,7 +275,7 @@ namespace DisplayMagician {
// Create the log console target
var logconsole = new NLog.Targets.ColoredConsoleTarget("logconsole")
{
Layout = "${longdate}|${level:uppercase=true}|${logger}|${message}${onexception:EXCEPTION OCCURRED\\:${exception:format=type,message,method:maxInnerExceptionLevel=5:innerFormat=shortType,message,method}}"
Layout = "${longdate}|${level:uppercase=true}|${logger}|${message}|${onexception:EXCEPTION OCCURRED \\:${exception::format=toString,Properties,Data}"
};
// Create a logging rule to use the log console target

View File

@ -26,8 +26,8 @@ using System.Resources;
[assembly: Guid("e4ceaf5e-ad01-4695-b179-31168eb74c48")]
// Version information
[assembly: AssemblyVersion("2.4.0.69")]
[assembly: AssemblyFileVersion("2.4.0.69")]
[assembly: AssemblyVersion("2.4.0.71")]
[assembly: AssemblyFileVersion("2.4.0.71")]
[assembly: NeutralResourcesLanguageAttribute( "en" )]
[assembly: CLSCompliant(true)]

View File

@ -1482,7 +1482,7 @@ namespace DisplayMagicianShared
catch (Exception ex)
{
// Guess that it is at the bottom (90% correct)
SharedLogger.logger.Error(ex, $"ProfileItem/GetWindowsScreenPositions: Exception trying to get the position of the taskbar on display {targetId}");
SharedLogger.logger.Warn(ex, $"ProfileItem/GetWindowsScreenPositions: Exception trying to get the position of the taskbar on display {targetId}");
screen.TaskBarEdge = TaskBarLayout.TaskBarEdge.Bottom;
}