nebula
nebula

Reputation: 3972

SLF4J implementation over Log4j

We have a application using log4j version 1.2.17 for logging. Now we are recommended to use SLF4J since log4j 1.2.17 seems very old. I found one of the option is to use SLF4J over Log4j but I am not quite sure about the logging performance using SLF4J over Log4j. So, keeping mind that we have to implement in both Tomcat and Jboss 7.2, using SLF4J alone is better or SLF4J over Log4j is?

Upvotes: 0

Views: 145

Answers (1)

Adrian Shum
Adrian Shum

Reputation: 40036

As the name of SLF4J suggest, it is only a "Facade".

Therefore, simply having SLF4J itself is not going to work. You need an backend that actually handle the logging request from SLF4J.

As you can imagine, using SLF4J + Log4J, performance-wise it is not going to be better than Log4J itself. However, it give you flexibility to switch to other logging backend.

There is a SLF4J-native logging backend which named Logback. It is believed that Logback out-performs Log4J. That means, SLF4J+Logback > Log4J > SLF4J+Log4J .

Upvotes: 2

Related Questions