Describe the bug
We are using Asp.net Core (3.1) and the "TraceSourceProvider" (logging.AddTraceSource(sourceSwitchName), which in turn uses the Microsoft.Extensions.Logging.TraceSource.TraceSourceLogger --> the TraceSourceLogger relies on the given MessageFormatter and does nothing withe the given exception.
Because Func<TState, Exception, string> formatter of the ILogger interface is not null the TraceSourceLogger "thinks" the exception has already been taken into account by the formatter and does not add the exception (message/stacktrace,...) to the message that will be finally logged.
We are using Microsoft.Extensions.Logging 3.1.3, should this be fixed in the MessageFormatter method or should the TraceSourceLogger take care to add exception details?
To Reproduce
Steps to reproduce the behavior:
- Configure Asp.Net Core logging to use the TraceSourceLogger (
logging.AddTraceSource(sourceSwitchName))
- Use
ILogger<SomeClass> and log an exception, e.q logger.LogError("some message", someException);
- Look at the log file, the exception is missing, the message ("some message") is available
Expected behavior
If an exception is available it should be taken care of in the MessageFormatter and therfore the exception should be visible in the log file.