It seems, that I cannot exclude the JBoss/ Wildfly Logging Subsystem.
I have an Java EE ear and would like to use slf4j API together with log4J2 Implementation.
My intention was to disable JBoss logging subsystem to let my slf4j log4j2 implementation handle the logging. But I still get duplicate handling of stdout:
12:55:00,820 INFO [stdout] (Thread-316) 12:55:00 INFO
the ear structure is as follows:
d----- 03.07.2020 12:53 lib
d----- 03.07.2020 12:53 META-INF
-a---- 03.07.2020 12:53 13238 org.example-helloworld-ejb-1.0-SNAPSHOT.jar
-a---- 03.07.2020 12:53 3598717 org.example-helloworld-web-1.0-SNAPSHOT.war
the lib directory:
-a---- 03.07.2020 12:53 26586 javax.annotation-javax.annotation-api-1.3.2.jar
-a---- 03.07.2020 12:53 63679 javax.ejb-javax.ejb-api-3.2.2.jar
-a---- 03.07.2020 12:53 28016 javax.transaction-javax.transaction-api-1.3.jar
-a---- 03.07.2020 12:53 126898 javax.ws.rs-javax.ws.rs-api-2.1.1.jar
-a---- 03.07.2020 12:53 292301 org.apache.logging.log4j-log4j-api-2.13.3.jar
-a---- 03.07.2020 12:53 1714164 org.apache.logging.log4j-log4j-core-2.13.3.jar
-a---- 03.07.2020 12:53 23590 org.apache.logging.log4j-log4j-slf4j-impl-2.13.3.jar
-a---- 03.07.2020 12:53 1526 org.example-helloworld-config-1.0-SNAPSHOT.jar
-a---- 03.07.2020 12:53 6071 org.example-helloworld-model-1.0-SNAPSHOT.jar
-a---- 03.07.2020 12:53 41203 org.slf4j-slf4j-api-1.7.25.jar
the META-INF directory:
-a---- 03.07.2020 12:53 470 jboss-deployment-structure.xml
content of jboss-deployment-structure.xml
:
<jboss-deployment-structure
xmlns="urn:jboss:deployment-structure:1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<deployment>
<dependencies>
<module name="config"/>
</dependencies>
<exclude-subsystems>
<subsystem name="logging" />
</exclude-subsystems>
</deployment>
</jboss-deployment-structure>
Furthermore I modified the standalone.xml
:
[..]
<profile>
<subsystem xmlns="urn:jboss:domain:logging:8.0">
<add-logging-api-dependencies value="false"/>
<console-handler name="CONSOLE">
<formatter>
[..]
My log4j2.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration monitorInterval="3" status="INFO">
<Appenders>
<Console name="Console1" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{1.}} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="all">
<AppenderRef ref="Console1"/>
</Root>
</Loggers>
</Configuration>
NOTE: I also tried using logback as the logging implementation. This also produces duplicately formatted output to stdout.#
Any hints to solve/ workaround this highly appreciated!