Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Conversation

keynan
Copy link

@keynan keynan commented Mar 10, 2017

This commit adds a little indirection around logger construction.
We found LD was to verbose, especially with warn messages.
This will let us (your customers) have fine grained control of what gets logged.

Aside: my personal position is there are exactly 2 log levels: fatal and debug. Everything else is just noise.

We found LD was to verbose, especially with warn messages.
This will let us (your customers) have fine grained controll of what gets logged.
Copy link
Contributor

@jkodumal jkodumal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 @drichelson what say you?

FeatureFlag featureFlag = config.featureStore.get(featureKey);
if (featureFlag == null) {
logger.warn("Unknown feature flag " + featureKey + "; returning default value");
logger.debug("Unknown feature flag " + featureKey + "; returning default value");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this change-- we've seen enough cases where an unknown FF is expected (e.g. test scenarios), so debug does feel appropriate to me.


private static AtomicReference<ILoggerFactory> factory = new AtomicReference<>();

public static void install(ILoggerFactory factory) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@keynan What do you think about making the LoggerFactory part of the config? Then this method doesn't need to be public, and it makes configuring the Logger consistent with the rest of the LDClient setup.
If there's a reason you need this to be configurable after the client has been created, then I'm curious..
(Depending on your logging framework, log levels can be changed at runtime outside of any code changes to this library)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! I would much rather have this be part of a constructor somewhere. This way was about expediency to start the conversation. I can amend the PR on Monday. How long, do you think, before we'd see it in a release?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In many cases loggers where instantiated in classes that did not refrence the config so I've left them as is. Where possible it now goes to the LDConfig to get a logger instance.

I couldn't get gradle to build locally so you should double check this all works before merging :/ sorry for the hassle

Couldn't build locally, so please confirm compilation.
@drichelson
Copy link
Contributor

drichelson commented Mar 13, 2017

Looking good!
I'm changing the base branch and merging so we can test this internally.

@drichelson drichelson changed the base branch from master to keynan/LogControl March 13, 2017 20:37
@drichelson drichelson merged commit 2ea58aa into launchdarkly:keynan/LogControl Mar 13, 2017
@drichelson
Copy link
Contributor

We're still targeting Java 1.7 for maximum compatibility- that's at least one source of the build error. I'll take a look at fixing it.

@drichelson
Copy link
Contributor

@keynan I reworked some things so there's less new code- The LDConfig class now has a static method called getLogger() that we're using to get the Logger. It defaults to the SLF4J LoggerFactory instance (previous behavior) or will use a custom LoggerFactory if the builder has one set.

We've pushed 2.2.0-SNAPSHOT, do you mind reviewing these changes and trying out the new version?

eli-darkly added a commit that referenced this pull request Aug 25, 2018
…ith-reasons

evaluation reasons can be included in allFlagsState()
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants