-
Notifications
You must be signed in to change notification settings - Fork 39
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
Simplify initialization of LoggingHandler.logger. #703
Conversation
cc32635
to
d2e952a
Compare
google-cloud-logging/src/test/java/com/google/cloud/logging/LoggingHandlerTest.java
Outdated
Show resolved
Hide resolved
d2e952a
to
b4244fc
Compare
getLogging() was called in the constructor of LoggingHandler. So, there's no reason to have lazy initialization for the logger.
b4244fc
to
3e0ca57
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should make sure that after close()
is called it is no longer possible to use the same logging
instance
} | ||
logging = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we still reset the logging instance here? since we do not throw exception we need a mechanism to avoid reuse of the potentially closed logging client.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The javadoc of Handler.close
, which we're overriding here, says:
After close has been called this {@code Handler} should no longer be used. Method calls may either be silently ignored or may throw runtime exceptions.
It's looks like a closed LoggingImpl
will simply drop messages, meeting the behavior specified by the documentation.
The change of this PR is implemented in #812 |
getLogging() was called in the constructor of LoggingHandler. So, there's no reason to have lazy initialization for the logger.
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #<issue_number_goes_here> ☕️