Logging
SmallRye Reactive Messaging uses JBoss Logging as logging API. This section explains how to configure the loggers for various logging backends.
Tip
If you are developing SmallRye Reactive Messaging and wonder about how the logs are managed, it uses JBoss Logging Tools.
Logging Backends
SmallRye Reactive Messaging uses the JBoss Logging library to write messages to a log file. This library is a logging bridge that integrates different log frameworks. You can decide which of the following frameworks you want to use for your application:
- JBoss LogManager (
jboss
) - Log4j 2 (
log4j2
) - Log4j 1 (
log4j
) - Slf4j (
slf4j
) - JDK logging (
jul
)
You only need to add the chosen framework to the classpath, and the
JBoss Logging library will pick it up. If there are multiple frameworks
available on the classpath, it picks the first found (in the order from
the list). Alternatively, you can set the org.jboss.logging.provider
system property is one of the values given above.
The concepts and log categories are the same for all frameworks. However, the format of the configuration file and the names of the log levels differ. Check the documentation of your logging library to find out which dependencies are required, the exact name of the log levels, and where the configuration should be written.
Log Categories
As all applications and frameworks, SmallRye Reactive Messaging writes log messages in different categories and log levels. The categories group messages from specific connectors, classes or components. The following table shows the essential log categories used by SmallRye Reactive Messaging:
Category | Description |
---|---|
io.smallrye.reactive.messaging |
This category contains all the messages written by SmallRye Reactive Messaging. |
io.smallrye.reactive.messaging.provider |
This category contains all the messages generated by the core (provider). |
io.smallrye.reactive.messaging.kafka |
This category contains all the messages generated by the Kafka Connector. |
io.smallrye.reactive.messaging.amqp |
This category contains all the messages generated by the AMQP Connector. |
io.smallrye.reactive.messaging.jms |
This category contains all the messages generated by the JMS Connector. |
io.smallrye.reactive.messaging.mqtt |
This category contains all the messages generated by the MQTT (Client) Connector. |
io.smallrye.reactive.messaging.mqtt-server |
This category contains all the messages generated by the MQTT (Server) Connector. |
The names of the log levels are defined by your logging framework and
determine the amount and granularity of the log messages. You can assign
a log level to each category. If you do not specify a specific
category’s log level, it will inherit the level from its parent
category. Thus, setting the log level of
io.smallrye.reactive.messaging
influences every loggers from SmallRye
Reactive Messaging.
Message Code
Each message has an identifier code. They are all prefixed with SRMSG
,
followed with the numeric code.
In the following output, the code is SRMSG00229
:
1 |
|
Recommended logging configurations
Development
Log4J 1
log4j.properties
Log4J 2
log4j2.xml
JDK (JUL)
logging.properties
LogBack via SLF4J*
logback.xml
Production
Log4J 1
log4j.properties
Log4J 2
log4j2.xml
JDK (JUL)
logging.properties
logback.xml