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

Provide ability to enable/disable Logbook in runtime #845

Closed
patkovskyi opened this issue Sep 28, 2020 · 2 comments
Closed

Provide ability to enable/disable Logbook in runtime #845

patkovskyi opened this issue Sep 28, 2020 · 2 comments

Comments

@patkovskyi
Copy link

Detailed Description

My team would like to have a way to enable/disable Logbook in runtime.

Context

We'd like to use ZooKeeper for the dynamic reconfiguration of our app.
Quickly disabling access log might be necessary for performance or privacy reasons.

Possible Implementation

Not sure.
Expose enable() / disable() methods on Logbook object?
Expose reconfigure() which would return a new builder()?

Your Environment

  • Version used: 2.2.0
  • Link to your project: proprietary
@whiskeysierra
Copy link
Collaborator

There are already two features that allow you to do that:

  1. Sink#isActive and HttpLogWriter#isActive
    If you use the DefaultSink and the DefaultHttpLogWriter then isActive delegates to the underlying Logger and checks whether the TRACE level is being activated. Most logging frameworks allow you to change log levels at runtime.
    In case you have a custom Sink implementation, you need to override isActive by hand.
  2. Custom condition
    A custom supplied condition (just a Predicate) is used for each request to determine whether logging is done or not. You can have one that has e.g. an AtomicBoolean inside that you can toggle, if needed.

@no-response
Copy link

no-response bot commented Oct 12, 2020

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

@no-response no-response bot closed this as completed Oct 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants