Skip to content

Commit 1ae4173

Browse files
KAFKA-19499: Corrected the logger name in PersisterStateManagerHandler (#20175)
This PR corrects the name of logger in the inner class PersisterStateManagerHandler. After this change it will be possible to change the log level dynamically in the kafka brokers. This PR also includes a small change in a log line in GroupCoordinatorService, making it clearer. Reviewers: Apoorv Mittal <apoorvmittal10@gmail.com>, Sushant Mahajan <smahajan@confluent.io>, Lan Ding <isDing_L@163.com>, TengYao Chi <frankvicky@apache.org>
1 parent 8614e15 commit 1ae4173

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupCoordinatorService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ private CompletableFuture<ShareGroupHeartbeatResponseData> handlePersisterInitia
796796
}
797797
return performShareGroupStateMetadataInitialize(groupId, topicPartitionMap, defaultResponse);
798798
}
799-
log.error("Received error while calling initialize state for {} on persister {}.", groupId, persisterError.code());
799+
log.error("Received error while calling initialize state for {} on persister, errorCode: {}.", groupId, persisterError.code());
800800
return uninitializeShareGroupState(persisterError, groupId, topicPartitionMap);
801801
}
802802

server-common/src/main/java/org/apache/kafka/server/share/persister/PersisterStateManager.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ public void setGenerateCallback(Runnable generateCallback) {
221221
public abstract class PersisterStateManagerHandler implements RequestCompletionHandler {
222222
protected Node coordinatorNode;
223223
private final BackoffManager findCoordBackoff;
224-
protected final Logger log = LoggerFactory.getLogger(getClass());
224+
protected final Logger log;
225225
private Consumer<ClientResponse> onCompleteCallback;
226226
protected final SharePartitionKey partitionKey;
227227

@@ -237,6 +237,11 @@ public PersisterStateManagerHandler(
237237
this.onCompleteCallback = response -> {
238238
}; // noop
239239
partitionKey = SharePartitionKey.getInstance(groupId, topicId, partition);
240+
String canonicalName = getClass().getCanonicalName();
241+
if (canonicalName == null) {
242+
canonicalName = getClass().getName();
243+
}
244+
log = LoggerFactory.getLogger(canonicalName);
240245
}
241246

242247
/**

0 commit comments

Comments
 (0)