Add routing of Flogger logs in Scylla CDC Source Connector to log4j.
Flogger is used in the underlying scylla-cdc-java library and before this change those logs were not forwarded to log4j. Debezium (as well as Kafka and Kafka Connect) use the log4j library.
To perform this routing, a dependency on flogger-log4j-backend is added. In static block flogger.backend_factory property is changed to use the log4j backend. This static block is placed before any other static initializations and it is present in two classes that can be loaded by Kafka Connect - ScyllaConnector and ScyllaConnectorTask. Such placement is very important, as it MUST be executed before any FluentLogger.forEnclosingClass() invocations (which read the System property).
I have done the following testing:
Run the connector on Confluent Platform. Logs from underlying library were correctly forwarded.
Run the connector on open-source Kafka (2.6.0), in Kafka Connect distributed mode (2 nodes). The first node loaded ScyllaConnector class (and afterwards the ScyllaConnectorTask class) and correctly forwarded the logs. The second node loaded only ScyllaConnectorTask class and also correctly forwarded the logs.
Add routing of Flogger logs in Scylla CDC Source Connector to log4j.
Flogger is used in the underlying scylla-cdc-java library and before this change those logs were not forwarded to log4j. Debezium (as well as Kafka and Kafka Connect) use the log4j library.
To perform this routing, a dependency on flogger-log4j-backend is added. In static block
flogger.backend_factory
property is changed to use the log4j backend. This static block is placed before any other static initializations and it is present in two classes that can be loaded by Kafka Connect -ScyllaConnector
andScyllaConnectorTask
. Such placement is very important, as it MUST be executed before anyFluentLogger.forEnclosingClass()
invocations (which read the System property).I have done the following testing:
ScyllaConnector
class (and afterwards theScyllaConnectorTask
class) and correctly forwarded the logs. The second node loaded onlyScyllaConnectorTask
class and also correctly forwarded the logs.