Forcing SLF4J-Test to be used

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Forcing SLF4J-Test to be used

Mike Mills
I am trying to use a gradle build to use log4j2 as the runtime implementation and slf4j-test as the test configuration.

In a standard gradle build this means that both the log4j2 and slf4j-test StaticLoggerBinders end up on the classpath during tests and there is no guarantee that the slf4j-test jars are used. (The build works on my windows machine but fails on the Solaris/Jenkins).

Is there a way to force slf4j to choose the slf4j-test library? 

Alternatively, would it make sense to modify slf4j to ALWAYS use the slf4j-test library if it is on the classpath?

Cheers for any suggestions.

_______________________________________________
slf4j-user mailing list
[hidden email]
http://mailman.qos.ch/mailman/listinfo/slf4j-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Forcing SLF4J-Test to be used

Robert Elliot
You could look into modifying grade’s test classpath; something like:

configurations.testRuntime.exclude(group: 'org.apache.logging.log4j', module: 'log4j-slf4j-impl')


On 25 Oct 2016, at 23:11, Mike Mills <[hidden email]> wrote:

I am trying to use a gradle build to use log4j2 as the runtime implementation and slf4j-test as the test configuration.

In a standard gradle build this means that both the log4j2 and slf4j-test StaticLoggerBinders end up on the classpath during tests and there is no guarantee that the slf4j-test jars are used. (The build works on my windows machine but fails on the Solaris/Jenkins).

Is there a way to force slf4j to choose the slf4j-test library? 

Alternatively, would it make sense to modify slf4j to ALWAYS use the slf4j-test library if it is on the classpath?

Cheers for any suggestions.
_______________________________________________
slf4j-user mailing list
[hidden email]
http://mailman.qos.ch/mailman/listinfo/slf4j-user


_______________________________________________
slf4j-user mailing list
[hidden email]
http://mailman.qos.ch/mailman/listinfo/slf4j-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Forcing SLF4J-Test to be used

Mike Mills
In reply to this post by Mike Mills


Thanks for the suggestion Robert, I came up with a slightly different solution that ultimately does the same thing:

test {
    classpath = classpath.filter {!it.name.contains('log4j-slf4j-impl')}
}


Is it a worthwhile idea to always have the SLF4J-test library be taken in preference to any other slf4j implementation found on the classpath?
 


_______________________________________________
slf4j-user mailing list
[hidden email]
http://mailman.qos.ch/mailman/listinfo/slf4j-user
Loading...