使用WildFly9&过冬

时间:2017-04-04 11:04:45

标签: java maven jboss wildfly logback

我无法使用WildFly 9配置回溯。

的pom.xml

<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-core</artifactId>
    <version>1.1.7</version>
</dependency>

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.7.25</version>
</dependency>

<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    <version>1.1.7</version>
</dependency>

我还在jboss-deployment-structure.xml文件夹中添加了WEB-INF(也在我的子项目中):

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
    <deployment>
        <!-- Exclusions allow you to prevent the server from automatically adding 
            some dependencies -->
        <exclusions>
            <module name="org.apache.commons.logging" />
            <module name="org.slf4j" />
            <module name="org.slf4j.ext" />
            <module name="org.slf4j.impl" />
            <module name="org.apache.log4j" />
        </exclusions>
    </deployment>
</jboss-deployment-structure>

每当我运行我的应用程序时,我都会看到默认日志,就好像首先没有加载回溯一样。 (没有找到没有找到logback配置的警告或错误等)

我尝试了多个线程但到目前为止没有一个对我有效

SLF4J + Logback does not log in WildFly

Application specific logging in WildFly 9.0.1 FINAL (SL4J + Logback)

我的logback.xml

<?xml version="1.0" encoding="UTF-8"?>
<configuration>

 <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
        <Pattern>%d{yyyy-MM-dd_HH:mm:ss.SSS} %-5level %logger{36} - %msg%n
                </Pattern>
    </encoder>
 </appender>

        <appender name="SLACK" class="com.github.maricn.logback.SlackAppender">
            <!-- Slack API token -->
            <!-- <token>1111111111-1111111-11111111-111111111</token> -->
            <!-- Slack incoming webhook uri. Uncomment the lines below to use incoming webhook uri instead of API token. -->
            <webhookUri>xxxxxxx</webhookUri>
            <!-- Channel that you want to post - default is #general -->
            <channel>xxx</channel>
            <!-- Formatting (you can use Slack formatting - URL links, code formatting, etc.) -->
            <layout class="ch.qos.logback.classic.PatternLayout">
                <pattern>%-4relative [%thread] %-5level %class - %msg%n</pattern>
            </layout>
            <!-- Username of the messages sender -->
            <username>xxxx</username>
            <!-- Emoji to be used for messages -->
            <iconEmoji>:stuck_out_tongue_winking_eye:</iconEmoji>
        </appender>

        <!-- Currently recommended way of using Slack appender -->
        <appender name="ASYNC_SLACK" class="ch.qos.logback.classic.AsyncAppender">
            <appender-ref ref="SLACK" />
            <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
                <level>ERROR</level>
            </filter>
        </appender>


  <logger name="org.hibernate.type" level="ALL" />
  <logger name="org.hibernate" level="DEBUG" />

  <root level="ERROR">
    <appender-ref ref="STDOUT" />
    <appender-ref ref="ASYNC_SLACK" />
  </root>

</configuration>

我错过了什么吗?

0 个答案:

没有答案