[slf4j-dev] [JIRA] (SLF4J-384) Implement slf4j to log4j2 bridge/adapter/impl

QOS.CH (JIRA) noreply-jira at qos.ch
Sun Feb 11 22:47:00 CET 2018


    [ https://jira.qos.ch/browse/SLF4J-384?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=19131#comment-19131 ] 

Jose Adolph commented on SLF4J-384:
-----------------------------------

The current documentation makes a very good explanation of the log4j 1.2 case which is past its end of life (since 08/2015.) Since there is no mention of the existence of log4j2 (not sure why!) I also assumed the 1.2 artifact should work and lost a some hours figuring out there is another component which resides in log4j2. Maybe a note in the FAQ is in order.

> Implement slf4j to log4j2 bridge/adapter/impl
> ---------------------------------------------
>
>                 Key: SLF4J-384
>                 URL: https://jira.qos.ch/browse/SLF4J-384
>             Project: SLF4J
>          Issue Type: New Feature
>            Reporter: John Tal
>            Assignee: SLF4J developers list
>            Priority: Minor
>
> Sorry if this is a dumb question. But I cannot find how slf4j would integrate on top of log4j2. 
> I have tried using slf4j 1.7.21 with log4j 2.7 and keep running into this: Failed to instantiate SLF4J LoggerFactory Reported exception: java.lang.NoClassDefFoundError: org/apache/log4j/Level at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150) at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124) 
> From what I can see, LoggerFactory is bound to log4j pre 2.0 as there is no .logging. in the package names: package org.slf4j.impl; import org.apache.log4j.Level; import org.slf4j.ILoggerFactory; import org.slf4j.LoggerFactory; import org.slf4j.helpers.Util; import org.slf4j.spi.LoggerFactoryBinder; /** * The binding of {@link LoggerFactory} class with an actual instance of * {@link ILoggerFactory} is performed using information returned by this class. * * @author Ceki Gülcü */ public class StaticLoggerBinder implements LoggerFactoryBinder { 
> If I want log4j2, and don't want to be locked into API, I can't use slf4j. I have to go back to commons-logging (JCL). Seems like a waste because JCL and it's class loader / config confusion is what led to creation of slf4j.  I'd rather keep on using slf4j and plug into whatever is the fastest logging framework at the time. From all the stats I see today, that is log4j2.  



--
This message was sent by Atlassian JIRA
(v7.3.1#73012)


More information about the slf4j-dev mailing list