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

Using environment variable to specify backend is too restrictive (ex: use inside application server or junit) #187

Open
gaelbillard opened this issue Sep 30, 2020 · 3 comments
Assignees
Labels
P3 type=addition A new feature

Comments

@gaelbillard
Copy link

Using -Dflogger.backend_factory=com.google.common.flogger.backend.slf4j.Slf4jBackendFactory#getInstance (for exemaple) to specify the backend to use is not usable for application running on same JVM with others like it is for tomcat or any application server. Even if it might be possible if one has control of the server, it will impact all application and could be problematic.
Could be imagine using a config file using a pre-defined name that would contains configuration that would be checked before looking at environment variable ?

@hagbard
Copy link
Contributor

hagbard commented Sep 30, 2020

This is a good point. For now I would suggest seeing if you can swap out the Platform class. DefaultPlatform is, well, a default and you can easily create an alternate Platform implementation which reads files for configuration instead of using system properties.

Of course you still have to specify that Platform with a system property, but it can then have a different instance per container and load different configurations.

@Gaibhne
Copy link

Gaibhne commented Mar 22, 2021

I came here to open an issue about exactly the same topic. Without any other way to specify logging backend, Flogger locks out a variety of common implementation patterns or introduces unreasonable hurdles (for example, there is no path to using Flogger in a project you want to test with JUnit while still supporting importing it in Eclipse).

@gaelbillard, I would ask you to change the issues title, as it unnecessarily narrows the scope of the issue to application servers, whereas the actual issue is more wide reaching and of interest to more people than just that exact scenario.

@gaelbillard gaelbillard changed the title Using environment variable to specify backend is not possible for application running under application server like tomcat or wildfly Using environment variable to specify backend is too restrictive (ex: use inside application server or junit) Mar 22, 2021
@Gaibhne
Copy link

Gaibhne commented Mar 25, 2021

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 type=addition A new feature
Projects
None yet
Development

No branches or pull requests

4 participants