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

Flushing logs slows down the application intensively (Error severity logs are flushed by default) we need a way to disable flushing #1143

Closed
montss opened this issue Oct 16, 2022 · 7 comments
Assignees
Labels
api: logging Issues related to the googleapis/java-logging API. logging-resilience priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@montss
Copy link

montss commented Oct 16, 2022

Environment details

  1. Java version: 11
  2. version(s): com.google.cloud:libraries-bom:26.1.3 --> com.google.cloud:google-cloud-logging-bom:3.11.5 --> com.google.cloud:google-cloud-logging:3.11.5

Steps to reproduce

Using JUL

Code example

		LoggingHandler googleHandler = new LoggingHandler();
		googleHandler.setFlushLevel(LoggingLevel.EMERGENCY);
		Logger logger = Logger.getLogger(TestClass.class.getName());
		logger.addHandler(googleHandler);

Any additional information below

Related to:-
googleapis/google-cloud-java#2796
googleapis/google-cloud-java#4254

Setting the flush level to something higher than error doesn't work.
Also setting it though logging.properties file doesn't work
com.google.cloud.logging.LoggingHandler.flushLevel=EMERGENCY

Error logs are flushed by default which causes massive slows down for that request overall
Profiling the system shows that most of the time are gone as a wall time on the flush call

We need a way to disable flushing for good.
Didn't try .setFlushLevel(Level.OFF);

@product-auto-label product-auto-label bot added the api: logging Issues related to the googleapis/java-logging API. label Oct 16, 2022
@losalex losalex assigned losalex and unassigned daniel-sanche Oct 16, 2022
@losalex losalex added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Oct 16, 2022
@losalex
Copy link
Contributor

losalex commented Oct 31, 2022

Thanks @montss for opening this issue. Just to clarify - calling setFlushLevel(Level.EMERGENCY) in code was not working for you, correct?

@montss
Copy link
Author

montss commented Nov 1, 2022

Thanks @montss for opening this issue. Just to clarify - calling setFlushLevel(Level.EMERGENCY) in code was not working for you, correct?

Correct, calling setFlushLevel(Level.EMERGENCY) didn't work nor setting it through the logging.properties file
com.google.cloud.logging.LoggingHandler.flushLevel=EMERGENCY

@daniel-sanche
Copy link
Contributor

I don't have much context on this, but possibly related issue: googleapis/java-logging-logback#319

@losalex
Copy link
Contributor

losalex commented Nov 24, 2022

I don't have much context on this, but possibly related issue: googleapis/java-logging-logback#319

Thanks @daniel-sanche for context! The one issue you shared indeed related to java-logback and is not relevant for java-logging.

@losalex
Copy link
Contributor

losalex commented Dec 1, 2022

@montss , I checked in a fix - would you please be able to test it and let me know it works for you?

@losalex
Copy link
Contributor

losalex commented Dec 7, 2022

Resolving this issue for now - feel free to reopen if it doesnt work or you have any other issues

@losalex losalex closed this as completed Dec 7, 2022
@montss
Copy link
Author

montss commented Jan 18, 2023

Thank you very much!
We can now turn off flushing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the googleapis/java-logging API. logging-resilience priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

3 participants