-
Notifications
You must be signed in to change notification settings - Fork 123
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
Teach Platform to load via ServiceLoader #12
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
Signed CLA |
CLAs look good, thanks! |
I'm not sure that ServiceLoader is what we'd want, because it can have bad performance in certain environments. Perhaps a command line flag to the JVM might serve the same goal without any performance considerations? /cc @hagbard |
Ah I just saw that @hagbard has an internal PR too have this configurable via system property. |
Thanks for the prompt response.
Use case is separating the use of the API from the implementation; goal would be to create ‘libA’ that uses flogger API and use the same binary in different contexts with potentially different logging back ends.
Current logging APIs (eg slf4j) allow for dropping in different JARs to support this.
System property would work, though it isn’t as transparent as ServiceLoader (or other ‘discoverable’ solns) and maybe limiting in some use cases (inability to set system props in managed environment, for example).
Chris.
… On Apr 22, 2018, at 4:26 PM, Ron Shapiro ***@***.***> wrote:
Ah I just saw that @hagbard has an internal PR too have this configurable via system property.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
…onfigured via system properties. Also made GooglePlatform no longer subclass DefaultPlatform since that had no real benefit in the design. I think there's more to do here, since it's really hard to test these classes. However this CL should let open-source stuff (e.g. log4j backend get moving better). Fixes #12 RELNOTES=Reworking underlying platform configuration to help support log4j backend ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=195079907
…onfigured via system properties. Also made GooglePlatform no longer subclass DefaultPlatform since that had no real benefit in the design. I think there's more to do here, since it's really hard to test these classes. However this CL should let open-source stuff (e.g. log4j backend get moving better). Fixes #12 RELNOTES=Reworking underlying platform configuration to help support log4j backend ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=195079907
Could it please be reconsidered to add support for
The problems @cslee00 listed are still the case, especially:
Similarly when a project using Flogger is used as dependency by other projects (with a different logging implementation), for each of them the System property needs to be set, which is rather error-prone (and not always possible). When using |
Allows back-ends to be loaded by dropping in JARs supporting ServiceLoader semantics. Preserves existing behaviour of only allowing a single Platform to be provided