Search code examples
javamavenlog4jmaven-plugin

A Maven plugin uses a library which logs with log4j


In a Mojo, I get a Logger by using getLog().

Assume I add a dependency to my maven plugin and call a method there. This dependency uses log4j.

Can I redirect the logging to the Maven logging?

EDIT:

I did not specify the version. I need a solution for log4j in version 1.2.17.


Solution

  • Excluding log4j and then using the dependency

        <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>log4j-over-slf4j</artifactId>
          <version>1.7.30</version>
        </dependency>
    

    seems to do the trick.