简体   繁体   中英

Wildfly logging module exclusion does not work for a large web app

I've written a small web app which disables Wildfly 10.1's slf4j implementation and uses its own logging libraries (logback). It works fine because LoggerFactory.getILoggerFactory() resolves to ch.qos.logback.classic.LoggerContext as result.

But then I use the same code for a larger application (with 52 jar files in WEB-INF/lib/ ) LoggerFactory.getILoggerFactory() still resolves to a JBoss implementation org.slf4j.impl.Slf4jLoggerFactory , as by default.

How can I investigate what exactly retains server's logging instead of the one of mine? (And fix the situation of course.)

Maven dependencies used: "slf4j-api" 1.6.1, "logback-classic" and "logback-core" 0.9.28.

File jboss-deployment-structure.xml , which is known to be located properly in both cases:

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
    <deployment>
        <exclusions>
            <module name="org.apache.common.logging"/>
            <module name="org.apache.log4j"/>
            <module name="org.jboss.log4j"/>
            <module name="org.jboss.log4j.logmanager"/>
            <module name="org.jboss.logging"/>
            <module name="org.slf4j"/>
            <module name="org.slf4j.impl"/>
        </exclusions>
    </deployment>
</jboss-deployment-structure>

I know it's a old topic but i had a similar problem. So, i will describe the problem and what i done to solve it.

I'm using spring-boot in my web application and running with jboss wildfly 10. When i try to integrate sentry and logback on my project, the application reads the file logback.xml but use another logging system.

I realized that wildfly was ignoring logback and using jboss-logging instead. So, i disabled the jboss logging module and than, my application started using logback and everything worked fine.

But this is how i disabled logging sub-system:

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

The link when i found my anwser:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM