简体   繁体   English

Wildfly日志记录模块排除不适用于大型Web应用程序

[英]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). 我编写了一个小型Web应用程序,该应用程序禁用了Wildfly 10.1的slf4j实现,并使用了自己的日志记录库(logback)。 It works fine because LoggerFactory.getILoggerFactory() resolves to ch.qos.logback.classic.LoggerContext as result. 之所以LoggerFactory.getILoggerFactory()正常工作,是因为LoggerFactory.getILoggerFactory()解析为ch.qos.logback.classic.LoggerContext作为结果。

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. 但是随后,我将相同的代码用于更大的应用程序( WEB-INF/lib/有52个jar文件), LoggerFactory.getILoggerFactory()仍默认解析为JBoss实现org.slf4j.impl.Slf4jLoggerFactory

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. 使用的Maven依赖项:“ slf4j-api” 1.6.1,“ logback-classic”和“ logback-core” 0.9.28。

File jboss-deployment-structure.xml , which is known to be located properly in both cases: 文件jboss-deployment-structure.xml ,在两种情况下都可以正确定位:

<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. 我在Web应用程序中使用spring-boot并与jboss wildfly 10一起运行。当我尝试在项目中集成哨兵和logback时,该应用程序读取文件logback.xml,但使用另一个日志记录系统。

I realized that wildfly was ignoring logback and using jboss-logging instead. 我意识到wildfly会忽略logback,而是使用jboss-logging。 So, i disabled the jboss logging module and than, my application started using logback and everything worked fine. 因此,我禁用了jboss日志记录模块,然后,我的应用程序开始使用logback,并且一切正常。

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: 当我找到我的anwser时的链接:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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