quarkus: Running JUnit tests in IDE doesn't set the LogManager
Describe the bug When running a QuarkustTest class as JUnit in Eclipse IDE, the quarkus.log.* entries set in application.properties are ignored, and logging defaults are used.
Expected behavior I expect to be able to see the same configured logging settings in a Maven run as in a IDE testclass run.
Actual behavior Rightclick a QuarkusTest class and select to run as JUnit. None of your debug() statements will write something in the console because the default log level is INFO and the quarkus.log.level=DEBUG from application.properties is ignored. The file is properly parsed, just the logging not initialized.
To Reproduce
- Take any quickstart project,
- add quarkus.log.level=DEBUG in its application.properties
- add a debug() statement in one of the unit tests
- run the maven install, the debug statement writes to the output
- run the class as junit, the debug statement writes nothing
Configuration
quarkus.log.level=DEBUG
Screenshots (If applicable, add screenshots to help explain your problem.)
Environment (please complete the following information):
- Output of
uname -aorver: Windows 10 - Output of
java -version: 11 (probably not relevant) - GraalVM version (if different from Java):
- Quarkus version or git rev: 1.4.2
- Build tool (ie. output of
mvnw --versionorgradlew --version): Maven 3.6.3, Eclipse 2020-03
Additional context (Add any other context about the problem here.) See also Zulip chat https://quarkusio.zulipchat.com/#narrow/stream/187030-users/topic/absolutebeginner
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 31 (31 by maintainers)
Commits related to this issue
- Fixes #9339 document log workaround in IDEs — committed to sorin-costea/quarkus by sorin-costea 4 years ago
- Merge pull request #9604 from sorin-costea/document-ide-junit-logging-workaround Fixes #9339 document log workaround in IDEs — committed to quarkusio/quarkus by stuartwdouglas 4 years ago
- Fixes #9339 document log workaround in IDEs — committed to johnaohara/quarkus by sorin-costea 4 years ago
In case somebody is interested, I use the workaround like this: I created a separate JRE definition in Eclipse, with only difference that it has as default VM arguments the logging manager. I use THIS as targeted runtime for Quarkus projects. It served me well, no need to define anything per run configuration anymore. But your mileage may vary, of course…
@machi1990 that is not working around this issue - configuring maven and gradle does not influence your runs from inside eclipse (and any other ide that runs the test directly via java)
we as a minimum shuold add the workaround for such IDE’s to the docs similar to how covered for gradle and maven but before doing that I wonder if there isn’t something we can do in the quarkustest extension to set this logmanager or if that is just an impossibility ? …if impossiblity - could we at least detect it and print a warning/help?
technically we could have eclipse quarkus tools add a 'run as quarkus junit` run config which only extra feature would to add that flag.