问题
In the ConfigureServices
method I'm using:
var loggerFactory = new LoggerFactory();
loggerFactory.AddDebug();
However, use of LogDebug()
fails to output to the debug console.
回答1:
Rather than rely on AddDebug()... specify the minimum log level with AddConsole() and the debug level information outputs to the console as expected:
loggerFactory.AddConsole(LogLevel.Debug);
This works because the methods AddConsole(), AddDebug() etc. only specify where to log information. The issue is discussed in more depth here.
来源:https://stackoverflow.com/questions/48938036/debug-level-information-fails-to-output-in-vs-code