How to add third party LogBack(SLF4J) in spring based application deployed on JBoss EAP?

Solution Unverified - Updated -

Issue

  • We are getting error message "LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation".
2023-09-13 10:03:08,968 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 90) MSC000001: Failed to start service jboss.deployment.unit."A.war".undertow-deployment: org.jboss.msc.service.StartException in service jboss.deployment.unit."A.war".undertow-deployment: java.lang.RuntimeException: java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation. If you are using WebLogic you will need to add 'org.slf4j' to prefer-application-packages: org.slf4j.impl.Slf4jLoggerFactory
  • We are trying to set up logging for our spring based application using Logback. We are trying to do this by using SLF4J to route all the logs to Logback. However, JBoss seems to have its own version of SLF4J to route logging to JBoss LogManager (which extends java.util.logging). One of our application dependencies uses java.util.logging, and JBoss has a jul-to-slf4j stub.

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content