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

Create a single root logger, rather than a root logger configuration #1

Merged
merged 1 commit into from Jun 8, 2014

Conversation

Projects
None yet
2 participants
@nblumhardt
Copy link
Contributor

nblumhardt commented Jun 7, 2014

If a file sink is added to a shared LoggerConfiguration like the original demo uses, then .CreateLogger() is called multiple times, the individual loggers will compete for use of the shared file.

The idiomatic way to do this is generally to create a root logger, then use ForContext() to create more specialized loggers off of it. This will aggregate events correctly into a single log file.

Create a single root logger, rather than a root logger configuration,…
… to prevent sharing issues when file sinks are used.

tnicolaysen added a commit that referenced this pull request Jun 8, 2014

Merge pull request #1 from nblumhardt/master
Create a single root logger, rather than a root logger configuration

That was how my code was first written, but when I rehearsed the presentation I noticed that it might be confusing for some. I tried to make it similar to the more traditional XML-config.
But, I entirely agree. This code should show a proper way to set up the configuration.

@tnicolaysen tnicolaysen merged commit 46ce276 into tnicolaysen:master Jun 8, 2014

@tnicolaysen

This comment has been minimized.

Copy link
Owner

tnicolaysen commented Jun 8, 2014

Thank you for the PR :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment