Search code examples
javamavenlogginglog4jartifactory

maven repository logger conflict


I'm writing a console app that uses https://github.com/jfrog/artifactory-client-java . In order to use it, I had to add

<dependency>
     <groupId>org.jfrog.artifactory.client</groupId>
     <artifactId>artifactory-java-client-services</artifactId>
     <version>2.6.2</version>
</dependency>

and

 <repositories>
     <repository>
         <id>repo1</id>
         <name>repo for artifactory</name>
         <url>http://repo.spring.io/libs-milestone/</url>
     </repository>
 </repositories>

Because version 2.6.2 was not in maven central repo. However adding these two completely broke my log4j configurations. My log4j version is:

    <!--logging-->
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>

I've tried excluding the logging dependencies from artifactory client but that results in error. How can I resolve this conflict and keep using my log4j.properties while also using Artifactory-java-client.

Edit: I've tried the 0.16 version of Artifactory client which is on maven central, still broke my logger configurations. So I think it has more to do with the dependency conflict than maven repository issue. Is there any workaround to resolve the logger conflict?

My dependencies


Solution

  • You need to exclude logback-classic from the dependency artifactory-java-client-services because that's a second complete logging framework similar to log4j.

    Keep the slf4j dependencies; those define an abstract logging API. To make logging work for artifactory-java-client-services, you need to tell slf4j to log via log4j. For this, add the dependency slf4j-log4j12 to your POM.