upgrading to wildfly 24 log issue

1,310 views
Skip to first unread message

Mokhtar Ammar

unread,
Aug 20, 2021, 9:15:59 AM8/20/21
to WildFly
i'm trying to migrate from wildfly 19 to wildfly 24 but when i deploy my application (which was perfectly working on wildfly19) i face face those errors 
{"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"algebraSystem-v1.1.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 (class org.slf4j.impl.Slf4jLoggerFactory loaded from jar:file:/F:/wildfly/modules/system/layers/base/org/slf4j/impl/main/slf4j-jboss-logmanager-1.1.0.Final.jar!/). If you are using WebLogic you will need to add 'org.slf4j' to prefer-application-packages in WEB-INF/weblogic.xml: org.slf4j.impl.Slf4jLoggerFactory
    Caused by: 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 (class org.slf4j.impl.Slf4jLoggerFactory loaded from jar:file:/F:/wildfly/modules/system/layers/base/org/slf4j/impl/main/slf4j-jboss-logmanager-1.1.0.Final.jar!/). If you are using WebLogic you will need to add 'org.slf4j' to prefer-application-packages in WEB-INF/weblogic.xml: org.slf4j.impl.Slf4jLoggerFactory
    Caused by: java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.slf4j.impl.Slf4jLoggerFactory loaded from jar:file:/F:/wildfly/modules/system/layers/base/org/slf4j/impl/main/slf4j-jboss-logmanager-1.1.0.Final.jar!/). If you are using WebLogic you will need to add 'org.slf4j' to prefer-application-packages in WEB-INF/weblogic.xml: org.slf4j.impl.Slf4jLoggerFactory"}} 

James Perkins

unread,
Aug 20, 2021, 9:51:36 AM8/20/21
to WildFly
Are you trying to use logback as the log manager? If so then you should likely remove the logging subsystem from your deployment with a jboss-deployment-structure.xml.

Mokhtar Ammar

unread,
Aug 20, 2021, 9:59:54 AM8/20/21
to WildFly

i'm unexperienced with wild and maven i tried to add this jboss-deployment-structure.xml :


<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
   <deployment>
        <exclusions>
              <module name="org.slf4j" />
              <module name="org.apache.log4j" />
          </exclusions>
   </deployment>
</jboss-deployment-structure>

can you please tell me what i'm missing ? and if possible can you give me a brief  explanation .

James Perkins

unread,
Aug 20, 2021, 11:22:29 AM8/20/21
to WildFly
If you're trying to use logback the simplest solution would be to exclude the logging subsystem as a whole:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
    <deployment>
        <exclude-subsystems>
            <subsystem name="logging"/>
        </exclude-subsystems>
    </deployment>
</jboss-deployment-structure>

If you'd rather not do that you also need to exclude org.slf4j.impl. Another option would be to change the add-logging-api-dependencies in the logging subsystem which would apply to all deployments. See https://docs.wildfly.org/24/Admin_Guide.html#how-do-i-use-my-own-version-of-log4j of log4j, but it should be mostly the same for logback.

Reply all
Reply to author
Forward
0 new messages