ppkarwasz commented on PR #3080:
URL: https://github.com/apache/logging-log4j2/pull/3080#issuecomment-2416186519

   > ⚠️ We've found out that 
[`OverflowTest`](https://github.com/apache/logging-log4j2/blob/cbe7e91304cd0d3681a3c6eedc1782b25cb96242/log4j-slf4j2-impl/src/test/java/org/apache/logging/slf4j/OverflowTest.java)
 is [set to run specifically with Junit 
4](https://github.com/apache/logging-log4j2/blob/cbe7e91304cd0d3681a3c6eedc1782b25cb96242/log4j-slf4j2-impl/pom.xml#L134).
 This behaviour was added not long ago so we wanted to ask, should we leave it 
like this or should we refactor `OverflowTest` to JUnit 5?
   
   As far as I can tell `OverflowTest` does not depend specifically on JUnit 4. 
It only requires an additional dependency (`log4j-to-slf4j`). The module should 
detect that Log4j API is redirected to SLF4J and should not forward SLF4J calls 
back to Log4j API.
   Taking advantage of new Maven Surefire Plugin capabilities I believe that 
such a configuration should work:
   
   ```xml
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-surefire-plugin</artifactId>
           <executions>
             <execution>
               <id>loop-test</id>
               <goals>
                 <goal>test</goal>
               </goals>
               <configuration>
                <additionalClasspathDependencies>
                  <dependency>
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-to-slf4j</artifactId>
                    <version>${project.version}</version>
                  </dependency>
                </additionalClasspathDependencies>
                 <includes>
                   <include>**/OverflowTest.java</include>
                 </includes>
               </configuration>
             </execution>
             <execution>
               <id>default-test</id>
               <configuration>
                 <includes>
                   <include>**/*Test.java</include>
                 </includes>
                 <excludes>
                   <exclude>**/OverflowTest.java</exclude>
                 </excludes>
               </configuration>
             </execution>
           </executions>
         </plugin>
   ```
   
   and `log4j-to-slf4j` can be removed from the `<dependencies>` section of the 
project.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to