quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.73k stars 2.67k forks source link

Important log message shown during Dev Services for Keycloak initialization is lost #25809

Closed sberyozkin closed 2 years ago

sberyozkin commented 2 years ago

Describe the bug

Not sure it is a bug, as I recall there was an issue related to some of the dev services related to the excessive logging.

But in any case, I recall it was possible to see various log messages logged by KeycloakDevServicesProcessor but now it is all being collapsed and all I see is

--
2022-05-26 12:38:41,657 INFO  [io.qua.oid.dep.dev.key.KeycloakDevServicesProcessor] (build-37) Dev Services for Keycloak started.

For example, KeycloakDevServicesProcessor logs if it can not find the configured realm file here, but it is not visible and the user has just spent a lot of time trying to figure out what went wrong in his replica of the keycloak-authorization quickstart which proved to be caused by a missing realm file.

I'm not sure throwing the exception in case of a missing realm would be a good dev experience given that one way to fix it is to go to Keycloak Admin UI from DevConsole and import a realm there if one sees a message that no realm is found.

Expected behavior

I think the messages logged by various Dev Services processors themselves (such as KeycloakDevSericesProcessor) should be visible, while the test containers logging can indeed be collapsed to minimize the noise.

Actual behavior

No response

How to Reproduce?

Go to the security-keycloak-authorization-quickstart in quarkus-quickstarts and change path to the realm to point to a non-existent location. mvn quarkus-dev will fail with error caused by the fact DevServices for Keycloak did not import it but no log message informing the user that the realm is missing will be shown

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

quarkus-bot[bot] commented 2 years ago

/cc @pedroigor, @stuartwdouglas

sberyozkin commented 2 years ago

Hi @stuartwdouglas I've looked at the code and I'm not sure I see how some log messages can be selectively shown in the console, what do you think ?

iocanel commented 2 years ago

I was affectected by the issue myself. I had no way of knowing what is going on and I had to actually debug to get an idea.

Some options that could make for a better developer experience:

Any of the above will save significant amount of time from users and will make for a way better experience than we currently have.

sberyozkin commented 2 years ago

Hi @iocanel I agree with the first point, my original thinking was, in devmode, one just continues by clicking on Keycloak Admin and continues dealing with realms there, importing them, etc, but the experience shows, that indeed, not failing early just causes problems. Though thinking a bit more about it, if we see an error log message that for ex the realm json is malformed, then the user goes ahead, updates the realm, DevServices for KC is already checking the file modification date so it should restart and retry to upload the realm. This flow may fit better into the dev mode style of working... I propose that we try to see first what can be done with controlling the log messages :-)

iocanel commented 2 years ago

Sounds good to me.

gsmet commented 2 years ago

I created a PR for it here: https://github.com/quarkusio/quarkus/pull/28533 .

Not sure if it actually do what you expect but if you want it to be non fatal, I think it's the way to go. If you want to switch to more fatal errors, then this PR should show you when to adjust the errors and throw exceptions.