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

Possibility to spool log events into a buffer, which are then output at some later point such as a request-handler throwing an exception? #51

Open
petemounce opened this issue Sep 24, 2012 · 2 comments

Comments

@petemounce
Copy link
Contributor

NLog over in the .NET world has this quite neat feature where it's possible to define conditional patterns (nlog calls these layouts), and also wrap appenders (which nlog calls targets). Combining these two features means it's possible to create a logger that spools events into a buffer, and then outputs them in the future, setting a minimum level according to whether an error occurred or not.

For example, responding to a web request involving talking to a third-party - when that conversation fails, it's really handy to get trace-level log-events which might include timing information, as opposed to just the default-configured warn-and-above and then relying on an operator to notice, crank up the volume, and hope it can be reproduced. Example configuration.

@TwP
Copy link
Owner

TwP commented Jun 3, 2013

I like this idea, and I'm trying to figure out how to do it without incurring a massive runtime penalty for the normal code path. If I'm understanding this concept correctly, then every logger will generate log events regardless of the currently set log level. Those events are then buffered (who clears the buffer and when?) until some other event happens. At that point those events are then flushed en masse to the logging destination. During this time normal logging is taking place, too.

The above paragraph is my stream of consciousness processing ... does that look correct?

@petemounce
Copy link
Contributor Author

Yes, that looks correct. In the .NET website world of the use-case, the buffer clear boundary would be the executing http request. Start a buffer at the beginning, flush/clear it at the end of the request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants