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
Configuration
quarkus.log.level=DEBUG
Screenshots
(If applicable, add screenshots to help explain your problem.)
Environment (please complete the following information):
uname -a
or ver
: Windows 10java -version
: 11 (probably not relevant)mvnw --version
or gradlew --version
): Maven 3.6.3, Eclipse 2020-03Additional context
(Add any other context about the problem here.)
See also Zulip chat https://quarkusio.zulipchat.com/#narrow/stream/187030-users/topic/absolutebeginner
Workaround: add
-Djava.util.logging.manager=org.jboss.logmanager.LogManager
to each and every run configuration - not very practical but mitigates the issue.
@FroMage isn't it the same issue you were talking about yesterday on Zulip?
Workaround: add
-Djava.util.logging.manager=org.jboss.logmanager.LogManager
to each and every run configuration - not very practical but mitigates the issue.
There is a workaround described here https://quarkus.io/guides/logging#how-to-configure-logging-for-quarkustest
@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?
Let's wait for @FroMage feedback because, if it's the same issue he was discussing yesterday, it's due to a JUnit issue.
@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)
Oops, I missed the IDE part sorry. You are very right indeed.
I use JUnit 5 fwiw
@gsmet yup, same issue, and look what JUnit answered: https://github.com/junit-team/junit5/issues/2300
So, as a workaround, how about the QuarkusClassLoader
detects this particular JUnit class being loaded and makes sure that we pre-load our system property? Or do we only come into play after JUnit, @stuartwdouglas ?
Quarkus comes into play after JUnit 5 has started
@FroMage +1 that was kinda what I was thinking - if we can detect we are running there and monkey patch it ...would be evil :)
and if monkey patch not feasible then possibly detect the system property are wrong/missing.
Or we turn again the JDK's LogManager
to re-init it. But that's gonna fail in the future. We could raise the issue to the openjdk team :-/
The way the JUnit answer was explained, it's really an issue with JUnit way of thinking "ide schmide". Not JDK...
Can we have this working in TestNG instead? I personally don't care which unit test framework I'm using.
@sorin-costea not sure what you mean by "ide schmide" - reason we are talking about JDK is that the issue is that jdk's logging setup assumes it setup early and only in once.
@sorin-costea
Workaround: add
-Djava.util.logging.manager=org.jboss.logmanager.LogManager
to each and every run configuration - not very practical but mitigates the issue.
You could also add it to the respective "Installed JREs" entry in Preferences.
But yeah, this _might_ have side effects and this also proves that Eclipse needs a templating mechanism for Junit Run Configurations...
technically we could have eclipse quarkus tools add a 'run as quarkus junit` run config which only extra feature would to add that flag.
technically we could have eclipse quarkus tools add a 'run as quarkus junit` run config
That would be a nice workaround, at least for the Eclipse users. Additionally it would be great if one could define custom arguments to apply to each run config (e.g. via Preferences).
Does this also affect other ides ? Idea and Netbeans uses mvn/Gradle to
execute does it not ?
On Fri, 15 May 2020 at 23:40, Falko Modler notifications@github.com wrote:
technically we could have eclipse quarkus tools add a 'run as quarkus
junit` run configThat would be a nice workaround, at least for the Eclipse users.
Additionally it would be great if one could define custom arguments to
apply to each run config (e.g. via Preferences).—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/quarkusio/quarkus/issues/9339#issuecomment-629505447,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAANG4INKYQRBGPN2TXVZILRRWZEBANCNFSM4NBPZUAA
.>
Regarding IntelliJ I have the same issue with:
<systemProperties>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
</systemProperties>
But I just googled this, and it actually works when changing to:
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
</systemPropertyVariables>
i.e. quarkus.log.level=DEBUG
in application.properties and I see debug logs, yay !
systemProperties
was actually deprecated in favor of systemPropertyVariables
in surefire 2.x versions.
I'll open a PR to change this in Quarkus itself + documentation, as I guess it'll be removed in surefire 3.Final anyway.
For Eclipse m2e, it seems similar feature was rejected due to technical limitation / out of scope: https://bugs.eclipse.org/bugs/show_bug.cgi?id=388683, https://bugs.eclipse.org/bugs/show_bug.cgi?id=406486 :-/
@rquinio Thanks for sharing these Eclipse Bugzilla links.
@maxandersen
technically we could have eclipse quarkus tools add a 'run as quarkus junit` run config
So I guess someone has to create a JBIDE-ticket for Eclipse?
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...
That is not a bad workaround @sorin-costea - would you be up for documenting that in the logging guide ?
@maxandersen sure I could make a PR to logging.adoc to add a section for IDE runs. Thing is, I only use Eclipse. I assume VSCode would need to add the workaround to settings.json (per project/workspace, good). About IntelliJ I have absolutely no idea.
lets get it started with one - then the rest will come :)
This is called 'Templates' in intellij, in the same screen you edit the run configuration you can edit the JUnit template, so it applies to all runs.
Okay cool, now where do I submit the PR, in the develop branch of quarkusio.github.io where I see the following info, or in the main repo which doesn't have a develop branch?
Contributing to the Quarkus.io website
Contributions are welcome, please submit pull requests for the develop branch.
Important: the guides are maintained in the main Quarkus repository and pull requests should be submitted there: https://github.com/quarkusio/quarkus/tree/master/docs/src/main/asciidoc.
@stuartwdouglas then it will apply to all projects of the workspace I assume, which might or might not be the desired outcome, right?
Intellij does not really use workspaces like eclipse does, each project generally has its own config.
PR is up. @stuartwdouglas please have look at the IntelliJ section as I don't know that IDE...
@stuartwdouglas shoudn't the IntelliJ Maven integration automatically pick up systemPropertyVariables from the surefire config in pom.xml?
It should, so if that has been changed I don't know if we need any docs around this for intellij
Most helpful comment
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...