I'm confused by NLog logging level fallbacks. I have this set of rules:
<rules>
<!-- Send Microsoft into a black hole to hide their logs -->
<logger name="Microsoft.*" maxLevel="Warn" final="true" />
<logger name="commands" minlevel="Info" writeTo="logger" final="true" />
<logger name="*" minlevel="Trace" writeTo="logger" />
<logger name="exception" minlevel="Error" writeTo="publisher" final="true" />
</rules>
What I expect to happen is that anything with a logger name of "commands" will only be logged at Info level or above. Any other logger name will be logged regardless.
What's happening is that when I get the logger for "commands" and I check its properties every log level is enabled, so if I provide a log level of Debug, then it's still logged. From what I understand, this shouldn't be the case.
I think this is something to do with my fallback logger (the name="*") I believe the "final=true" on the "commmand" logger should any further logging checks.
This is running in .net core
Am I misunderstanding how this works?
Maybe this will work:
<rules>
<!-- Send Microsoft into a black hole to hide their logs -->
<logger name="Microsoft.*" maxLevel="Warn" final="true" />
<logger name="commands" maxLevel="Debug" final="true" />
<logger name="commands" minlevel="Info" writeTo="logger" final="true" />
<logger name="*" minlevel="Trace" writeTo="logger" />
<logger name="exception" minlevel="Error" writeTo="publisher" final="true" />
</rules>