Skip to content

Commit 657eb86

Browse files
committed
Polish "Add a config prop to enable/disable SI's default logging"
See gh-28355
1 parent c6891c5 commit 657eb86

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationProperties.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,9 +395,12 @@ public void setCron(String cron) {
395395
public static class Management {
396396

397397
/**
398-
* Logging management in the integration components.
398+
* Whether Spring Integration components should perform logging in the main
399+
* message flow. When disabled, such logging will be skipped without checking the
400+
* logging level. When enabled, such logging is controlled as normal by the
401+
* logging system's log level configuration.
399402
*/
400-
boolean defaultLoggingEnabled = true;
403+
private boolean defaultLoggingEnabled = true;
401404

402405
public boolean isDefaultLoggingEnabled() {
403406
return this.defaultLoggingEnabled;

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/integration/IntegrationAutoConfigurationTests.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,13 @@ void whenFixedRatePollerPropertyIsSetThenItIsReflectedAsFixedRatePropertyOfPerio
486486
}
487487

488488
@Test
489-
void integrationManagementLoggingDisabled() {
489+
void integrationManagementLoggingIsEnabledByDefault() {
490+
this.contextRunner.withBean(DirectChannel.class, DirectChannel::new).run((context) -> assertThat(context)
491+
.getBean(DirectChannel.class).extracting(DirectChannel::isLoggingEnabled).isEqualTo(true));
492+
}
493+
494+
@Test
495+
void integrationManagementLoggingCanBeDisabled() {
490496
this.contextRunner.withPropertyValues("spring.integration.management.defaultLoggingEnabled=false")
491497
.withBean(DirectChannel.class, DirectChannel::new).run((context) -> assertThat(context)
492498
.getBean(DirectChannel.class).extracting(DirectChannel::isLoggingEnabled).isEqualTo(false));

0 commit comments

Comments
 (0)