New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing documentation on rules for NLog.config #3377
Comments
Hi! Thanks for opening your first issue here! Please make sure to follow the issue template - so we could help you better! |
I created #2891 to resolve #2394, so I could use it for NLog-config in appsettings.json (Allowing targets and rules to have name-attribute without it suddenly meaning logger-name for rules). It has just been released with NLog 4.6 so it is kind of new. Sadly enough the XML So I settled for it being an easter-egg for those who need to fiddle with their logging-rules at runtime through code instead of nlog.config. You are welcome to make a PR makes it possible to do this |
OK I have to check what is now implemented. Not what I had in mind... |
thanks for reporting! |
I was looking at how to configure logger rules in NLog.config. I wanted to add a name (identifier) to rule. I tried following Rules section and I got confused about how to assign this name to a rule.
After digging through the code I found a property named RuleName. It was not clear from the wiki how this property is assign using
<logger>
tag. I found out that this tag does not support such attribute. You need to use<rule>
tag within<rules>
. There was no information in the wiki about this<rule>
tag and difference between it and the<logger>
tag.Example:
<logger name="*" minlevel="Info" writeTo="defaultlogfile" />
<rule name="defaultlogfile" logger="*" minlevel="Info" writeTo="defaultlogfile"/>
I am not sure if these two tags can be used simultaneously pointing to different targets.
All in all, I would ask to update the wiki about
<rule>
tag and the difference between it and the<logger>
(if this information is not located in some other place already).The text was updated successfully, but these errors were encountered: