Skip to content

Commit 9e199fb

Browse files
garyrussellartembilan
authored andcommitted
Add Newlines When Logging Container Config
- add missing properties
1 parent bcf8fdb commit 9e199fb

File tree

3 files changed

+45
-38
lines changed

3 files changed

+45
-38
lines changed

spring-kafka/src/main/java/org/springframework/kafka/listener/ConsumerProperties.java

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -439,24 +439,26 @@ public String toString() {
439439

440440
protected final String renderProperties() {
441441
return renderTopics()
442-
+ ", pollTimeout=" + this.pollTimeout
443-
+ (this.groupId != null ? ", groupId=" + this.groupId : "")
444-
+ (StringUtils.hasText(this.clientId) ? ", clientId=" + this.clientId : "")
442+
+ "\n pollTimeout=" + this.pollTimeout
443+
+ (this.groupId != null ? "\n groupId=" + this.groupId : "")
444+
+ (StringUtils.hasText(this.clientId) ? "\n clientId=" + this.clientId : "")
445445
+ (this.consumerRebalanceListener != null
446-
? ", consumerRebalanceListener=" + this.consumerRebalanceListener
446+
? "\n consumerRebalanceListener=" + this.consumerRebalanceListener
447447
: "")
448-
+ (this.commitCallback != null ? ", commitCallback=" + this.commitCallback : "")
449-
+ ", syncCommits=" + this.syncCommits
450-
+ (this.syncCommitTimeout != null ? ", syncCommitTimeout=" + this.syncCommitTimeout : "")
451-
+ (this.kafkaConsumerProperties.size() > 0 ? ", properties=" + this.kafkaConsumerProperties : ""
452-
+ ", authorizationExceptionRetryInterval=" + this.authorizationExceptionRetryInterval);
448+
+ (this.commitCallback != null ? "\n commitCallback=" + this.commitCallback : "")
449+
+ "\n syncCommits=" + this.syncCommits
450+
+ (this.syncCommitTimeout != null ? "\n syncCommitTimeout=" + this.syncCommitTimeout : "")
451+
+ (this.kafkaConsumerProperties.size() > 0 ? "\n properties=" + this.kafkaConsumerProperties : "")
452+
+ "\n authorizationExceptionRetryInterval=" + this.authorizationExceptionRetryInterval
453+
+ "\n commitRetries=" + this.commitRetries
454+
+ "\n fixTxOffsets" + this.fixTxOffsets;
453455
}
454456

455457
private String renderTopics() {
456-
return (this.topics != null ? "topics=" + Arrays.toString(this.topics) : "")
457-
+ (this.topicPattern != null ? ", topicPattern=" + this.topicPattern : "")
458+
return (this.topics != null ? "\n topics=" + Arrays.toString(this.topics) : "")
459+
+ (this.topicPattern != null ? "\n topicPattern=" + this.topicPattern : "")
458460
+ (this.topicPartitions != null
459-
? ", topicPartitions=" + Arrays.toString(this.topicPartitions)
461+
? "\n topicPartitions=" + Arrays.toString(this.topicPartitions)
460462
: "");
461463
}
462464

spring-kafka/src/main/java/org/springframework/kafka/listener/ContainerProperties.java

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -874,29 +874,33 @@ private void adviseListenerIfNeeded() {
874874
public String toString() {
875875
return "ContainerProperties ["
876876
+ renderProperties()
877-
+ ", ackMode=" + this.ackMode
878-
+ ", ackCount=" + this.ackCount
879-
+ ", ackTime=" + this.ackTime
880-
+ ", messageListener=" + this.messageListener
877+
+ "\n ackMode=" + this.ackMode
878+
+ "\n ackCount=" + this.ackCount
879+
+ "\n ackTime=" + this.ackTime
880+
+ "\n messageListener=" + this.messageListener
881881
+ (this.consumerTaskExecutor != null
882-
? ", consumerTaskExecutor=" + this.consumerTaskExecutor
882+
? "\n consumerTaskExecutor=" + this.consumerTaskExecutor
883883
: "")
884-
+ ", shutdownTimeout=" + this.shutdownTimeout
885-
+ ", idleEventInterval="
884+
+ "\n shutdownTimeout=" + this.shutdownTimeout
885+
+ "\n idleEventInterval="
886886
+ (this.idleEventInterval == null ? "not enabled" : this.idleEventInterval)
887-
+ ", idlePartitionEventInterval="
887+
+ "\n idlePartitionEventInterval="
888888
+ (this.idlePartitionEventInterval == null ? "not enabled" : this.idlePartitionEventInterval)
889889
+ (this.transactionManager != null
890-
? ", transactionManager=" + this.transactionManager
890+
? "\n transactionManager=" + this.transactionManager
891891
: "")
892-
+ ", monitorInterval=" + this.monitorInterval
893-
+ (this.scheduler != null ? ", scheduler=" + this.scheduler : "")
894-
+ ", noPollThreshold=" + this.noPollThreshold
895-
+ ", subBatchPerPartition=" + this.subBatchPerPartition
896-
+ ", assignmentCommitOption=" + this.assignmentCommitOption
897-
+ ", deliveryAttemptHeader=" + this.deliveryAttemptHeader
898-
+ ", eosMode=" + this.eosMode
899-
+ "]";
892+
+ "\n monitorInterval=" + this.monitorInterval
893+
+ (this.scheduler != null ? "\n scheduler=" + this.scheduler : "")
894+
+ "\n noPollThreshold=" + this.noPollThreshold
895+
+ "\n subBatchPerPartition=" + this.subBatchPerPartition
896+
+ "\n assignmentCommitOption=" + this.assignmentCommitOption
897+
+ "\n deliveryAttemptHeader=" + this.deliveryAttemptHeader
898+
+ "\n eosMode=" + this.eosMode
899+
+ "\n transactionDefinition=" + this.transactionDefinition
900+
+ "\n stopContainerWhenFenced=" + this.stopContainerWhenFenced
901+
+ "\n stopImmediate=" + this.stopImmediate
902+
+ "\n asyncAcks=" + this.asyncAcks
903+
+ "\n]";
900904
}
901905

902906
}

spring-kafka/src/main/java/org/springframework/kafka/listener/KafkaMessageListenerContainer.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ else if (listener instanceof MessageListener) {
771771
this.monitorTask = this.taskScheduler.scheduleAtFixedRate(this::checkConsumer, // NOSONAR
772772
Duration.ofSeconds(this.containerProperties.getMonitorInterval()));
773773
if (this.containerProperties.isLogContainerConfig()) {
774-
this.logger.info(this.toString());
774+
this.logger.info(toString());
775775
}
776776
Map<String, Object> props = KafkaMessageListenerContainer.this.consumerFactory.getConfigurationProperties();
777777
this.checkNullKeyForExceptions = checkDeserializer(findDeserializerClass(props, consumerProperties, false));
@@ -2922,14 +2922,15 @@ public void seekToTimestamp(Collection<TopicPartition> topicParts, long timestam
29222922
@Override
29232923
public String toString() {
29242924
return "KafkaMessageListenerContainer.ListenerConsumer ["
2925-
+ "containerProperties=" + this.containerProperties
2926-
+ ", listenerType=" + this.listenerType
2927-
+ ", isConsumerAwareListener=" + this.isConsumerAwareListener
2928-
+ ", isBatchListener=" + this.isBatchListener
2929-
+ ", autoCommit=" + this.autoCommit
2930-
+ ", consumerGroupId=" + this.consumerGroupId
2931-
+ ", clientIdSuffix=" + KafkaMessageListenerContainer.this.clientIdSuffix
2932-
+ "]";
2925+
+ "\ncontainerProperties=" + this.containerProperties
2926+
+ "\nother properties ["
2927+
+ "\n listenerType=" + this.listenerType
2928+
+ "\n isConsumerAwareListener=" + this.isConsumerAwareListener
2929+
+ "\n isBatchListener=" + this.isBatchListener
2930+
+ "\n autoCommit=" + this.autoCommit
2931+
+ "\n consumerGroupId=" + this.consumerGroupId
2932+
+ "\n clientIdSuffix=" + KafkaMessageListenerContainer.this.clientIdSuffix
2933+
+ "\n]";
29332934
}
29342935

29352936
private void closeProducers(@Nullable Collection<TopicPartition> partitions) {

0 commit comments

Comments
 (0)