Skip to content

Commit

Permalink
The formatter implementation from Microsoft.Extensions.Logging.Logger…
Browse files Browse the repository at this point in the history
…Extensions class is ignoring the exception object and the exception information is not saved into log file. see the existing implemetation from below. (#1827)

Added handling for situation when the exception is not null and reused the existing code for formatting exceptions.
  • Loading branch information
OctaviaStan committed May 31, 2022
1 parent 23a8930 commit 8cc18b3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Stack/Opc.Ua.Core/Types/Utils/Utils.cs
Expand Up @@ -557,6 +557,10 @@ public static void Trace<TState>(TState state, Exception exception, int traceMas
// append process and timestamp.
message.AppendFormat(CultureInfo.InvariantCulture, "{0:d} {0:HH:mm:ss.fff} ", DateTime.UtcNow.ToLocalTime());
message.Append(formatter(state, exception));
if (exception != null)
{
message.Append(TraceExceptionMessage(exception, String.Empty, null));
}
}
catch (Exception)
{
Expand Down

0 comments on commit 8cc18b3

Please sign in to comment.