Polish "Add a config prop to enable/disable SI's default logging"

See gh-28355
pull/28398/head
Andy Wilkinson 3 years ago
parent c6891c5184
commit 657eb86dad

@ -395,9 +395,12 @@ public class IntegrationProperties {
public static class Management {
/**
* Logging management in the integration components.
* Whether Spring Integration components should perform logging in the main
* message flow. When disabled, such logging will be skipped without checking the
* logging level. When enabled, such logging is controlled as normal by the
* logging system's log level configuration.
*/
boolean defaultLoggingEnabled = true;
private boolean defaultLoggingEnabled = true;
public boolean isDefaultLoggingEnabled() {
return this.defaultLoggingEnabled;

@ -486,7 +486,13 @@ class IntegrationAutoConfigurationTests {
}
@Test
void integrationManagementLoggingDisabled() {
void integrationManagementLoggingIsEnabledByDefault() {
this.contextRunner.withBean(DirectChannel.class, DirectChannel::new).run((context) -> assertThat(context)
.getBean(DirectChannel.class).extracting(DirectChannel::isLoggingEnabled).isEqualTo(true));
}
@Test
void integrationManagementLoggingCanBeDisabled() {
this.contextRunner.withPropertyValues("spring.integration.management.defaultLoggingEnabled=false")
.withBean(DirectChannel.class, DirectChannel::new).run((context) -> assertThat(context)
.getBean(DirectChannel.class).extracting(DirectChannel::isLoggingEnabled).isEqualTo(false));

Loading…
Cancel
Save