[id="changing-logging-level"]
= Changing the logging level

The default {prodname} logging level provides sufficient information to show whether a connector is healthy or not.
However, if a connector is not healthy,
you can change its logging level to troubleshoot the issue.

In general, {prodname} connectors send their log messages to loggers with names that match the fully-qualified name of the Java class that is generating the log message.
{prodname} uses packages to organize code with similar or related functions.
This means that you can control all of the log messages for a specific class or for all of the classes within or under a specific package.

.Procedure

. Open the `log4j.properties` file.

. Configure a logger for the connector.
+
--
This example configures loggers for the MySQL connector and the database history implementation used by the connector,
and sets them to log `DEBUG` level messages:

.log4j.properties
[source,properties,options="nowrap"]
----
...
log4j.logger.io.debezium.connector.mysql=DEBUG, stdout  // <1>
log4j.logger.io.debezium.relational.history=DEBUG, stdout  // <2>

log4j.additivity.io.debezium.connector.mysql=false  // <3>
log4j.additivity.io.debezium.relational.history=false  // <3>
...
----
<1> Configures the logger named `io.debezium.connector.mysql` to send `DEBUG`, `INFO`, `WARN`, and `ERROR` messages to the `stdout` appender.
<2> Configures the logger named `io.debezium.relational.history` to send `DEBUG`, `INFO`, `WARN`, and `ERROR` messages to the `stdout` appender.
<3> Turns off _additivity_,
which means that the log messages will not be sent to appenders of parent loggers (this can prevent seeing duplicate log messages when using multiple appenders).
--

. If necessary, change the logging level for a specific subset of the classes within the connector.
+
--
Increasing the logging level for the entire connector increases the log verbosity,
which can make it difficult to understand what is happening.
In these cases,
you can change the logging level just for the subset of classes that are related to the issue that you are troubleshooting.
--

.. Set the connector's logging level to either `DEBUG` or `TRACE`.

.. Review the connector's log messages.
+
--
Find the log messages that are related to the issue that you are troubleshooting.
The end of each log message shows the name of the Java class that produced the message.
--

.. Set the connector's logging level back to `INFO`.

.. Configure a logger for each Java class that you identified.
+
--
For example, consider a scenario in which you are unsure why the MySQL connector is skipping some events when it is processing the binlog.
Rather than turn on `DEBUG` or `TRACE` logging for the entire connector,
you can keep the connector's logging level at `INFO` and then configure `DEBUG` or `TRACE` on just the class that is reading the binlog:

.log4j.properties
[source,properties,options="nowrap"]
----
...
log4j.logger.io.debezium.connector.mysql=INFO, stdout
log4j.logger.io.debezium.connector.mysql.BinlogReader=DEBUG, stdout
log4j.logger.io.debezium.relational.history=INFO, stdout

log4j.additivity.io.debezium.connector.mysql=false
log4j.additivity.io.debezium.relational.history=false
log4j.additivity.io.debezium.connector.mysql.BinlogReader=false
...
----
--
