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

Logger program keeps running #111

Closed
Dwapayan opened this issue Mar 8, 2019 · 7 comments
Closed

Logger program keeps running #111

Dwapayan opened this issue Mar 8, 2019 · 7 comments

Comments

@Dwapayan
Copy link

Dwapayan commented Mar 8, 2019

After we run the following the program does not exit:

private static Logger LOGGER = LogManager.getLogger(LoggerTest.class); -> Declared in class scope

LOGGER.info("This is a new string message - info"); -> run from main function

Is some thread still running causing the program to get stuck in execution. The message in the line is sent to splunk but then program does not exit.

Are there ant methods to dispose logger ?

@shakeelmohamed
Copy link
Contributor

Hi @Dwapayan, which version of the Java logging library are you using?

@Dwapayan
Copy link
Author

Dwapayan commented Mar 14, 2019

@shakeelmohamed This is happening with both 1.6.2 and 1.7.1 with JDK 11.0.2

@shakeelmohamed
Copy link
Contributor

Can you try adding LogManager.shutdown(); to your code? We were able to use that as a workaround for older JDKs

@SuramVishal
Copy link
Contributor

@shakeelmohamed Unfortunately LogManager.shutdown() itself will not work in all scenarios.
Scenario :
Main method calls LogManager.shutdown(), causing HttpEventCollectorLogbackAppender.stop(), which in turn HttpEventCollectorSender.flush(true) and if eventsBatch.size() == 0, we do not close the httpClient.
I have raised a PR for you to consider. :)
#112

@fantavlik
Copy link
Contributor

@fantavlik
Copy link
Contributor

Please let us know if you continue to see this behavior in version 1.7.2. Thanks!

@Dwapayan
Copy link
Author

This problem is not solved yet. I tried the 1.7.2 and got the same issue. When 1.7.2 library is added just the declaration causes program to keep running

private static Logger LOGGER = LogManager.getLogger(LoggerTest.class);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants