apache / apache/maven-surefire

[SUREFIRE-1545] Not possible to configure java.util.logging with failsafe plugin in forked JVM

Open
#2,226 0 comments 0 reactions 0 assignees View on GitHub
enhancement priority:minor
Dominant language
Java
Stars
461
Forks
588
Avg merge
1d 8h
Merged PRs (30d)
19

Description

**[Scott Kurz](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=scottkurz)** opened **[SUREFIRE-1545](https://issues.apache.org/jira/browse/SUREFIRE-1545?redirect=false)** and commented

As suggested here:  https://stackoverflow.com/a/12276898/634324  I'm simply doing this (using the updated rather than deprecated prop name) which forks a JVM (the default):
            \
                \maven-failsafe-plugin\
                \2.22.0\
                \
                    \
                        ${project.basedir}/src/test/resources/logging.properties
                    \
                \
                \
                    \
                        \default-integration-test\
                        \integration-test\
                        \
                            \integration-test\
                        \
                    \
                \
            \
But it doesn't seem to be having any effect.

I stepped through it a bit in the debugger... enough to see that it seems to be that this sequence:
https://github.com/apache/maven-surefire/blob/19ea21e3d7681c33a158dd7e06e8b5a993a33d85/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java#L91-L95
ends up initializing the LogManager before a system prop like java.util.logging.config.file can be set.
I could add a test case if it helps, but I think this should be easy to recreate just based on the above.

Would be interested to hear if there is a better way to do this (making this improvement unnecessary).  And I guess a workaround is probably not forking the JVM, but that wasn't a good fit for me.

 

---

**Affects:** 2.22.0

Contributor guide

Open the contributing guide

Research direction

Start in surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java at the initialization sequence around lines 91-95, and trace when the forked JVM reads java.util.logging.config.file. Reproduce the Maven Failsafe configuration from the issue with a forked JVM; done means the specified logging.properties takes effect during integration tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.