Purpose of IsDebugEnabled (in NLog specifically)?


I was having troubles seeing Trace and Debug-level log messages and couldn’t figure out why, when my deeply-nested watch-variable NLogger (see screenshot) was set to trace, debug, warn etc all == true. (see attached image), but the IsDebugEnabled=false on the higher level object. This leaves me a bit confused as to the purpose of the higher level object ILog.IsDebugEnabled property? It seems to always be set to FALSE in my NLog implementation, but I can use Logger.Debug(“my debug msg”) to get output successfuly. Can/should IsDebugEnabled just be ignored? Or if not, what is its intended purpose?

For others who arrive here, I found the root cause of my missing DEBUG and TRACE messages was actually a .netcore config-issue (which, for anyone else with this issue, you can find the Github ticket below and see the solution is to set the webhostbuilder to use a minimum logging level),

return new WebHostBuilder()
// To see Trace or Debug-level logging, have to set Program to use some minimum logging 
// level, even though actual Loggers are configured much later.
// see: https://github.com/NLog/NLog.Web/issues/167
.ConfigureLogging((context, loggingBuilder) => { loggingBuilder.SetMinimumLevel(LogLevel.Trace); })

The purpose of the log flags is to prevent any calculations used to create the debug log messages. The NLogLogger implementation returns the NLog.IsDebugEnabled property: