SLF4J + Logback does not log in WildFly

后端 未结 2 1249
别那么骄傲
别那么骄傲 2020-12-01 12:35

I run web application in WildFly 8 and for some reason it does not log. I use SLF4J with LOGBACK. The log file is created on deploy but it is empty. I do not see my log stat

相关标签:
2条回答
  • 2020-12-01 13:05

    Wildfly is using slf4j as defult logging. you have to tell jboss not to use slf4j, i am using log4j. you can do this using below jboss-deployment-structure.xml

    <jboss-deployment-structure>
      <deployment>
         <!-- exclude-subsystem prevents a subsystems deployment unit processors running on a deployment -->
         <!-- which gives basically the same effect as removing the subsystem, but it only affects single deployment -->
         <exclude-subsystems>
            <subsystem name="logging" />
        </exclude-subsystems>
      </deployment>
    </jboss-deployment-structure>
    
    0 讨论(0)
  • 2020-12-01 13:16

    WildFly adds slf4j as a default logging dependency Have you tried excluding the main implementation in jboss-deployment-structure.xml descriptor (It should go under the META-INF directory). This can be done with below lines:

    <?xml version="1.0" encoding="UTF-8"?>
    <jboss-deployment-structure>
      <deployment>
        <exclusions>
          <module name="org.apache.commons.logging" />
          <module name="org.apache.log4j" />
          <module name="org.jboss.logging" />
          <module name="org.jboss.logging.jul-to-slf4j-stub" />
          <module name="org.jboss.logmanager" />
          <module name="org.jboss.logmanager.log4j" />
          <module name="org.slf4j" />
          <module name="org.slf4j.impl" />
        </exclusions>
      </deployment>
    </jboss-deployment-structure>
    
    0 讨论(0)
提交回复
热议问题