Search code examples
jenkinsjunit4logback

Jenkins build fails because it is looking for log path defined in logback.xml when executing junit test


I am getting the following error on Jenkins when I try to do a gradle build of my code along with Junit tests:

Caused by: java.lang.IllegalStateException: java.lang.IllegalStateException: Logback configuration error detected: 
ERROR in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - Failed to create parent directories for xxxxxx

Basically Jenkins is trying to look for the directory specified in the logback.xml, but it doesn't have permission to build the directory structure.

I am using the Jacoco plugin with Jenkins for generating test reports.

Any help to resolve this issue is very much appreciated.

Thanks


Solution

  • I resolved the issue by using @TestPropertySource(properties = "logging.config=classpath:logback.xml") where in the logback-spring.xml was ignored during Jenkins build.