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

Request logging does not work in @QuarkuTests #26138

Closed
oscarfh opened this issue Jun 14, 2022 · 8 comments · Fixed by #28571
Closed

Request logging does not work in @QuarkuTests #26138

oscarfh opened this issue Jun 14, 2022 · 8 comments · Fixed by #28571

Comments

@oscarfh
Copy link
Contributor

oscarfh commented Jun 14, 2022

Describe the bug

This reproducer shows the issue: there I used a template from code.quarkus.com and the resteasy reactive client tutorial and tried to log the traffic as described in the documentation.

If I run ./gradlew quarkusDev and manually open my browser in localhost:8080/hello, then I can see the request logs. The problem is that this does not happen in tests: if I run a test using @QuarkusTest, the logs are not shown.
(The same applied to CLI applications).

Expected behavior

Logs should be shown both in tests and in "production" environments.

Actual behavior

Log configuration is ignored in tests.

How to Reproduce?

Reproducer: https://github.com/oscarfh/quarkus-request-log-issue

  1. Check out the repository
  2. Run ./gradlew quarkusDev
  3. Open localhost:8080/hello in your browser/curl
  4. Notice that there are logs for the call made to https://stage.code.quarkus.io/api
  5. Stop the app
  6. Run org.acme.ApplicationMainIT#myTest
  7. Notice how the traffic logging does not happen

Output of uname -a or ver

Linux laptoip 5.11.0-41-generic #45~20.04.1-Ubuntu SMP Wed Nov 10 10:20:10 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

openjdk version "17.0.3" 2022-04-19 OpenJDK Runtime Environment (build 17.0.3+7-Ubuntu-0ubuntu0.20.04.1) OpenJDK 64-Bit Server VM (build 17.0.3+7-Ubuntu-0ubuntu0.20.04.1, mixed mode, sharing)

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)

2.9.2.Final

Additional information

No response

@oscarfh oscarfh added the kind/bug Something isn't working label Jun 14, 2022
@albers
Copy link
Contributor

albers commented Jul 5, 2022

https://stage.code.quarkus.io/ is down at the moment (showing "Failed to load Quarkus config" but still serving a status code of 200).

I came across this issue while trying the rest-client-reactive-quickstart, too.

Maybe your issue is caused by that.

@albers
Copy link
Contributor

albers commented Jul 7, 2022

https://stage.code.quarkus.io/ is available again.

@oscarfh
Copy link
Contributor Author

oscarfh commented Jul 13, 2022

@albers Thanks for you reply, but that was not the case because I got the replies when debugging and because when running the application as jar, the logs were printed.

@quarkus-bot
Copy link

quarkus-bot bot commented Oct 12, 2022

/cc @Sgitario, @cescoffier, @geoand

@geoand
Copy link
Contributor

geoand commented Oct 12, 2022

This has to do with how logging is (not) configured in generated Gradle projects.

In Maven projects we make sure that JBoss Logmanager is used (by setting a system property for surefire and failsafe), but in Gradle projects we don't do this.

By adding:

test {
    systemProperty "java.util.logging.manager", "org.jboss.logmanager.LogManager"
}

logging works correctly.

@glefloch @gsmet @dmlloyd any idea why we don't do ^?

@dmlloyd
Copy link
Member

dmlloyd commented Oct 12, 2022

Not sure; it seems reasonable to me.

@glefloch
Copy link
Member

That's what we do in sample test projects and what recommanded in the doc. I can add it to the gradle code start as well, I don't know why it's not the case yet

@geoand
Copy link
Contributor

geoand commented Oct 13, 2022

Okay thanks.

Let's add it then as logging in tests is pretty broken without it.

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

Successfully merging a pull request may close this issue.

7 participants