KAFKA-7353: Connect logs 'this' for anonymous inner classes

Replace 'this' reference in anonymous inner class logs to out class's 'this'

Author: Kevin Lafferty <kevin.lafferty@gmail.com>

Reviewers: Randall Hauch <rhauch@gmail.com>, Arjun Satish <arjun@confluent.io>, Ewen Cheslack-Postava <ewen@confluent.io>

Closes #5583 from kevin-laff/connect_logging
This commit is contained in:
Kevin Lafferty 2018-09-05 20:15:25 -07:00 committed by Ewen Cheslack-Postava
parent 79a608b286
commit 847780e5a5
3 changed files with 7 additions and 7 deletions

View File

@ -89,7 +89,7 @@ public class WorkerConnector {
@Override
public void raiseError(Exception e) {
log.error("{} Connector raised an error", this, e);
log.error("{} Connector raised an error", WorkerConnector.this, e);
onFailure(e);
ctx.raiseError(e);
}

View File

@ -649,7 +649,7 @@ class WorkerSinkTask extends WorkerTask {
long pos = consumer.position(tp);
lastCommittedOffsets.put(tp, new OffsetAndMetadata(pos));
currentOffsets.put(tp, new OffsetAndMetadata(pos));
log.debug("{} Assigned topic partition {} with offset {}", this, tp, pos);
log.debug("{} Assigned topic partition {} with offset {}", WorkerSinkTask.this, tp, pos);
}
sinkTaskMetricsGroup.assignedOffsets(currentOffsets);

View File

@ -326,11 +326,11 @@ class WorkerSourceTask extends WorkerTask {
// timeouts, callbacks with exceptions should never be invoked in practice. If the
// user overrode these settings, the best we can do is notify them of the failure via
// logging.
log.error("{} failed to send record to {}: {}", this, topic, e);
log.debug("{} Failed record: {}", this, preTransformRecord);
log.error("{} failed to send record to {}: {}", WorkerSourceTask.this, topic, e);
log.debug("{} Failed record: {}", WorkerSourceTask.this, preTransformRecord);
} else {
log.trace("{} Wrote record successfully: topic {} partition {} offset {}",
this,
WorkerSourceTask.this,
recordMetadata.topic(), recordMetadata.partition(),
recordMetadata.offset());
commitTaskRecord(preTransformRecord);
@ -454,9 +454,9 @@ class WorkerSourceTask extends WorkerTask {
@Override
public void onCompletion(Throwable error, Void result) {
if (error != null) {
log.error("{} Failed to flush offsets to storage: ", this, error);
log.error("{} Failed to flush offsets to storage: ", WorkerSourceTask.this, error);
} else {
log.trace("{} Finished flushing offsets to storage", this);
log.trace("{} Finished flushing offsets to storage", WorkerSourceTask.this);
}
}
});