I currently use NLog and allow admin users to set the level at runtime using a variable as follows:
<logger name="*" minLevel="${var:myFileLevel}" writeTo="file" />
I would like to know the level of this logger at runtime (so I cannot obtain it from the configuration file due to the variable)
I am able to easily obtain the Target as follows:
Target target= LogManager.Configuration.FindTargetByName("file");
but unfortunately there are no relevant methods on the target object to obtain the level. Is it possible to obtain the logging level at runtime?
Logger.IsEnabled(logLevel)
or particularLogger.Is*Enabled
properties? This allows you to be sure in what's configured for any given logger. – Dennis