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

Unable to get logs in JSON format with native binary #159

Closed
devatherock opened this issue May 9, 2022 · 0 comments · Fixed by #160
Closed

Unable to get logs in JSON format with native binary #159

devatherock opened this issue May 9, 2022 · 0 comments · Fixed by #160
Labels
bug Something isn't working

Comments

@devatherock
Copy link
Owner

devatherock commented May 9, 2022

Couldn't find a way to pass logback.configurationFile system property to the native binary. Could be fixed by introducing an environment variable LOGBACK_CONFIGURATION_FILE, in of the below two ways.

Option 1:

if (System.getProperty(PROP_LOGBACK_CONFIG) == null &&
                System.getenv(ENV_LOGBACK_CONFIG) != null) {
            LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();

            try {
                JoranConfigurator configurator = new JoranConfigurator();
                configurator.setContext(context);
                context.reset();
                configurator.doConfigure(
                        Application.class.getClassLoader().getResourceAsStream(System.getenv(ENV_LOGBACK_CONFIG)));
            } catch (JoranException je) {
                // StatusPrinter will handle this
            }
            StatusPrinter.printInCaseOfErrorsOrWarnings(context);
}

Option 2:

if (System.getProperty(PROP_LOGBACK_CONFIG) == null &&
                System.getenv(ENV_LOGBACK_CONFIG) != null) {
            System.setProperty(PROP_LOGBACK_CONFIG, System.getenv(ENV_LOGBACK_CONFIG));
}
@devatherock devatherock added the bug Something isn't working label May 9, 2022
devatherock added a commit that referenced this issue May 9, 2022
Closes #159. Needed as it wasn't clear how to set the JVM arg
`logback.configurationFile` with the graalvm binary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant