-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Close the delayed log handler if exception #20797
Conversation
@@ -194,6 +195,9 @@ public void close() throws Throwable { | |||
|
|||
return state; | |||
} catch (Throwable e) { | |||
if (!InitialConfigurator.DELAYED_HANDLER.isActivated()) { | |||
InitialConfigurator.DELAYED_HANDLER.close(); |
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.
Wouldn't activate
make more sense here?
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.
Well, activate()
is private so no :).
And it won't work. If the handler has not been activated, we don't have any nested handler contributed by the Quarkus bootstrap so we somehow have to push the log records ourselves.
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.
Ah right, was thinking of something else.
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.
I remembered: LoggingSetupRecorder.handleFailedStart();
is what I was after
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.
Maybe we should register a shutdown hook instead in io.quarkus.bootstrap.logging.InitialConfigurator
? Also LoggingSetupRecorder.handleFailedStart();
is potentially better than just calling close, as it will mostly respect the logging settings.
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.
5d19217
to
5f15374
Compare
@@ -36,8 +38,6 @@ | |||
public static final ExtensionContext.Namespace NAMESPACE = ExtensionContext.Namespace | |||
.create("io.quarkus.test.main.jvm"); | |||
|
|||
private static Map<String, String> devServicesProps; |
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.
This field was unused.
If the handler has not been activated, we flush the content of the log when we have an exception. Otherwise, the user is missing important information. This is especially important when a resource does not start properly.
5f15374
to
794c71b
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.
LGTM, thanks!
Failing Jobs - Building 794c71b
Full information is available in the Build summary check run. Failures⚙️ JVM Tests - JDK 17 #- Failing: extensions/smallrye-reactive-messaging-kafka/deployment
! Skipped: integration-tests/kafka-oauth-keycloak integration-tests/kafka-sasl-elytron integration-tests/kubernetes/quarkus-standard-way-kafka and 2 more 📦 extensions/smallrye-reactive-messaging-kafka/deployment✖
|
If the handler has not been activated, we flush the content of the log
when we have an exception. Otherwise, the user is missing important
information.
This is especially important when a test resource does not start properly.
@stuartwdouglas could you have a look at this one? I saw a user complain about this and I also had the issue lately in the quickstarts and this helped. I'm not sure if I have found all the potential places I should adjust. Any other you have in mind?