Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between slf4j-log4j12 and log4j-slf4j-impl

Tags:

log4j

log4j2

In some projects which used slf4j and log4j I can see dependencies like

compile('org.apache.logging.log4j:log4j-core:version')
compile('org.apache.logging.log4j:log4j-api:version')
compile('org.apache.logging.log4j:log4j-slf4j-impl:version')

But some projects use slf4j-log4j12 instead of log4j-slf4j-impl. To my understanding they are both works like bridges between slf4j and log4j, but what's their difference?

like image 618
RBB Avatar asked Dec 03 '25 18:12

RBB


1 Answers

Those artifacts use different versions of Log4j:

  • slf4j-log4j12 is a bridge between SLF4J and Log4j 1.2. Its versioning follows SLF4J.
  • slf4j-reload4j is a bridge between SLF4J and Reload4j (a clone of Log4j 1.2). Its versioning follows SLF4J.
  • log4j-slf4j-impl is a bridge between SLF4J 1 (up to 1.7.x) and Log4j 2 API. Its versioning follows LOG4J2.
  • log4j-slf4j2-impl is a bridge between SLF4J 2 (or higher) and Log4j 2 API. Its versioning follows LOG4J2.

Since Log4j 1.x reached end-of-life in 2015, there is no sense in using the first one in new software.

like image 134
Piotr P. Karwasz Avatar answered Dec 08 '25 04:12

Piotr P. Karwasz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!