[KAFKA-188] errors.log.enable=true does not log Exception when errors.tolerance=all Created: 28/Jan/21  Updated: 28/Oct/23  Resolved: 03/Feb/21

Status: Closed
Project: Kafka Connector
Component/s: Sink
Affects Version/s: 1.3.0
Fix Version/s: 1.4.0

Type: Bug Priority: Major - P3
Reporter: Louis DEVERGNIES Assignee: Ross Lawley
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Documentation says :

errors.log.enable: When set to true, both errors that are tolerated (determined by the errors.tolerance setting) and not tolerated are written.

But:

When settings errors.tolerance=all and errors.log.enable=true Then only MongoException are logged.

 

Cause probably is in catch block in com.mongodb.kafka.connect.sink.MongoSinkTask.processSinkRecords(MongoSinkTopicConfig config, List<SinkRecord> batch)

private void processSinkRecords(final MongoSinkTopicConfig config, final List<SinkRecord> batch) {
	...
	try {
		...
	} catch (MongoException e) {
		...
 		handleMongoException(config, e);
 	} catch (Exception e) {
 		if (!config.tolerateErrors()) {
			...
		}
	}
}
 
private void handleMongoException(final MongoSinkTopicConfig config, final MongoException e) {
	...
	if (config.logErrors()) {
		...
	}
	if (!config.tolerateErrors()) {
		...
	}
	...
}



 Comments   
Comment by Githook User [ 03/Feb/21 ]

Author:

{'name': 'Ross Lawley', 'email': 'ross.lawley@gmail.com', 'username': 'rozza'}

Message: Fix logging of general exceptions (#51)

KAFKA-188
Branch: master
https://github.com/mongodb/mongo-kafka/commit/a791b0d23c389e03769851ca17f9ce1b07336c30

Comment by Ross Lawley [ 28/Jan/21 ]

Thanks louis.devergnies@ext.adeo.com for reporting this.

Scheduling this for the next release.

Generated at Thu Feb 08 09:05:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.