I need to configure NLog settings from another application, essentially I have a main Application and a Configuration Application and need to set some log settings from the Configuration Application.
I have tried below but minlevel
is an enum
and is not valid.. :(
<logger name="*" minlevel="${appsetting:MinimumLogLevel}" writeTo="File" />
It would be perfect for this to work, any suggestions?
Thanks
** Updated Answer **
NLog ver. 4.6 added support for using NLog-Config-Variables in minLevel. See https://github.com/NLog/NLog/pull/2709
NLog ver. 4.6.7 added support for adjusting minLevel at runtime, by modifying NLog-Config-Variables and calling
ReconfigExistingLoggers()
. See https://github.com/NLog/NLog/pull/3184** Original Answer **
the
minlevel
attribute is indeed not aLayout
, so you can't use layout renderers like `${appsetting}.You could do it programmatically:
or if it should work for all rules, you could use
GlobalThreshold
: