Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.

Chapter 1. JBoss LogManager and supported logging frameworks


Quarkus uses the JBoss LogManager logging backend to collect and manage log data. You can use JBoss Logging to collect data about Quarkus internal events and also about the events within your application. You can configure logging behavior in your application.properties file.

JBoss LogManager supports several third-party logging APIs in addition to the JBoss Logging. JBoss LogManager merges the logs from all the supported logging APIs.

Quarkus handles all of its logging functionalities using JBoss Logging. When you use a library that relies on a different logging API, you need to exclude this library from the dependencies and configure JBoss Logging to use a logging adapter for the third-party API.

1.1. Adding Apache Log4j logging framework

Apache Log4j is a logging framework that includes a logging backend and a logging API. Since Quarkus uses the JBoss LogManager backend, you can add the log4j2-jboss-logmanager library to your project and use Log4j as a logging API. Adding the Log4j library routes the Log4j logs to the JBoss Log Manager. You do not need to include any Log4j dependencies.

Procedure

  • Add the log4j2-jboss-logmanager library as a dependency of your project’s pom.xml file:

pom.xml

    <dependency>
      <groupId>org.jboss.logmanager</groupId>
      <artifactId>log4j2-jboss-logmanager</artifactId>
    </dependency>
Copy to Clipboard Toggle word wrap

The log4j2-jboss-logmanager is the library for the Log4J version 2 API. If you want to use the legacy Log4J version 1 API then you must add the log4j-jboss-logmanager instead.

1.2. Using logging adapters

Quarkus relies on the JBoss Logging library for all the logging requirements.

When you are using libraries that have dependencies on other logging libraries, such as Apache Commons Logging, Log4j, or SLF4j, you must exclude those logging libraries from the dependencies and use one of the adapters provided by JBoss Logging. You do not need to add an adapter for libraries that are dependencies of Quarkus extensions.

Note

The third-party logging implementation is not included in the native executable and your application might fail to compile with an error message similar to the following:

Caused by java.lang.ClassNotFoundException: org.apache.commons.logging.impl.LogFactoryImpl
Copy to Clipboard Toggle word wrap

You can prevent this error by configuring a JBoss Logging adapter for the third-party logging implementation that you use.

Procedure

  • Depending on the logging library that you are using, add one of the adapters to your pom.xml file:

    • Apache Commons Logging:

      pom.xml

      <dependency>
          <groupId>org.jboss.logging</groupId>
          <artifactId>commons-logging-jboss-logging</artifactId>
      </dependency>
      Copy to Clipboard Toggle word wrap

    • Log4j:

      pom.xml

      <dependency>
          <groupId>org.jboss.logmanager</groupId>
          <artifactId>log4j-jboss-logmanager</artifactId>
      </dependency>
      Copy to Clipboard Toggle word wrap

    • Log4j2:

      pom.xml

      <dependency>
          <groupId>org.jboss.logmanager</groupId>
          <artifactId>log4j2-jboss-logmanager</artifactId>
      </dependency>
      Copy to Clipboard Toggle word wrap

    • SLF4j:

      pom.xml

      <dependency>
          <groupId>org.jboss.slf4j</groupId>
          <artifactId>slf4j-jboss-logmanager</artifactId>
      </dependency>
      Copy to Clipboard Toggle word wrap

Nach oben
Red Hat logoGithubredditYoutubeTwitter

Lernen

Testen, kaufen und verkaufen

Communitys

Über Red Hat Dokumentation

Wir helfen Red Hat Benutzern, mit unseren Produkten und Diensten innovativ zu sein und ihre Ziele zu erreichen – mit Inhalten, denen sie vertrauen können. Entdecken Sie unsere neuesten Updates.

Mehr Inklusion in Open Source

Red Hat hat sich verpflichtet, problematische Sprache in unserem Code, unserer Dokumentation und unseren Web-Eigenschaften zu ersetzen. Weitere Einzelheiten finden Sie in Red Hat Blog.

Über Red Hat

Wir liefern gehärtete Lösungen, die es Unternehmen leichter machen, plattform- und umgebungsübergreifend zu arbeiten, vom zentralen Rechenzentrum bis zum Netzwerkrand.

Theme

© 2025 Red Hat