An available version suit of slf4j and log4j2 with Maven 3.
pom.xml
1 | <dependency> |
log4j2.xml
1 | <?xml version="1.0" encoding="UTF-8"?> |
If you want to use log4j-slf4j-impl
instead of log4j-slf4j18-impl
, please attention to take right version of SLF4J to avoid a break in compatibility. Because SLF4J take different mechanism since 1.8.x.
The Log4j 2 SLF4J Binding allows applications coded to the SLF4J API to use Log4j 2 as the implementation.
Due to a break in compatibility in the SLF4J binding, as of release 2.11.1 two SLF4J to Log4j Adapters are provided.
- log4j-slf4j-impl should be used with SLF4J 1.7.x releases or older.
- log4j-slf4j18-impl should be used with SLF4J 1.8.x releases or newer.
Applications that take advantage of the Java Module System should use SLF4J 1.8.x and log4j-slf4j18-impl.