Log4j2 Note

If you really only need to get log4j2 working in your maven build, do this.

1. Start with deps

<dependencies>

  <dependency>

    <groupId>org.apache.logging.log4j</groupId>

    <artifactId>log4j-api</artifactId>

    <version>2.6.1</version>

  </dependency>

  <dependency>

    <groupId>org.apache.logging.log4j</groupId>

    <artifactId>log4j-core</artifactId>

    <version>2.6.1</version>

  </dependency>

</dependencies>

 

2.  Import these

import org.apache.logging.log4j.LogManager;

import org.apache.logging.log4j.Logger;

 

3. Use this

 private static Logger log = LogManager.getLogger();