Skip to content
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

Closed
mindisk opened this issue May 7, 2019 · 6 comments
Closed

Missing documentation on rules for NLog.config #3377

mindisk opened this issue May 7, 2019 · 6 comments
Assignees
Labels
documentation done all docs done (wiki, api docs, lists on nlog-project.org, xmldocs) documentation needs documentation on wiki XSD change
Milestone

Comments

@mindisk
Copy link

mindisk commented May 7, 2019

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).

@welcome
Copy link

welcome bot commented May 7, 2019

Hi! Thanks for opening your first issue here! Please make sure to follow the issue template - so we could help you better!

@snakefoot
Copy link
Contributor

snakefoot commented May 7, 2019

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 <logger>-tag uses the attribute name=, and telling everyone that they now should use <rule> with attribute logger= just incase they wanted to give their logging-rules an identifier sounded like hard work without any winners.

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 <logger name="..." rulename="123" />, and then make a nice Wiki-page about it.

@304NotModified
Copy link
Member

304NotModified commented May 20, 2019

There was a mistake in the docs I see:

image

fixed it:

update this is wrong. remove it for now

I will also update the XSD

@304NotModified 304NotModified added documentation done all docs done (wiki, api docs, lists on nlog-project.org, xmldocs) and removed documentation done all docs done (wiki, api docs, lists on nlog-project.org, xmldocs) labels May 20, 2019
@304NotModified
Copy link
Member

OK I have to check what is now implemented. Not what I had in mind...

@304NotModified
Copy link
Member

@304NotModified
Copy link
Member

thanks for reporting!

@304NotModified 304NotModified added the documentation done all docs done (wiki, api docs, lists on nlog-project.org, xmldocs) label May 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation done all docs done (wiki, api docs, lists on nlog-project.org, xmldocs) documentation needs documentation on wiki XSD change
Projects
None yet
Development

No branches or pull requests

3 participants