Example usage for org.springframework.integration.support.management IntegrationManagement setLoggingEnabled

List of usage examples for org.springframework.integration.support.management IntegrationManagement setLoggingEnabled

Introduction

In this page you can find the example usage for org.springframework.integration.support.management IntegrationManagement setLoggingEnabled.

Prototype

@ManagedAttribute(description = "Use to disable debug logging during normal message flow")
    void setLoggingEnabled(boolean enabled);

Source Link

Usage

From source file:org.springframework.integration.config.IntegrationManagementConfigurer.java

@Override
public void afterSingletonsInstantiated() {
    Assert.state(this.applicationContext != null, "'applicationContext' must not be null");
    Assert.state(MANAGEMENT_CONFIGURER_NAME.equals(this.beanName),
            getClass().getSimpleName() + " bean name must be " + MANAGEMENT_CONFIGURER_NAME);
    if (ClassUtils.isPresent("io.micrometer.core.instrument.MeterRegistry",
            this.applicationContext.getClassLoader())) {
        this.metricsCaptor = MicrometerMetricsCaptor.loadCaptor(this.applicationContext);
    }//from   ww w .  ja v  a 2s .com
    if (this.metricsCaptor != null) {
        injectCaptor();
        registerComponentGauges();
    }
    if (this.metricsFactory == null && StringUtils.hasText(this.metricsFactoryBeanName)) {
        this.metricsFactory = this.applicationContext.getBean(this.metricsFactoryBeanName,
                MetricsFactory.class);
    }
    if (this.metricsFactory == null) {
        Map<String, MetricsFactory> factories = this.applicationContext.getBeansOfType(MetricsFactory.class);
        if (factories.size() == 1) {
            this.metricsFactory = factories.values().iterator().next();
        }
    }
    if (this.metricsFactory == null) {
        this.metricsFactory = new DefaultMetricsFactory();
    }
    this.sourceConfigurers.putAll(this.applicationContext.getBeansOfType(MessageSourceMetricsConfigurer.class));
    Map<String, IntegrationManagement> managed = this.applicationContext
            .getBeansOfType(IntegrationManagement.class);
    for (Entry<String, IntegrationManagement> entry : managed.entrySet()) {
        IntegrationManagement bean = entry.getValue();
        if (!bean.getOverrides().loggingConfigured) {
            bean.setLoggingEnabled(this.defaultLoggingEnabled);
        }
        String name = entry.getKey();
        doConfigureMetrics(bean, name);
    }
    this.singletonsInstantiated = true;
}

From source file:org.springframework.integration.config.IntegrationManagementConfigurer.java

private void injectCaptor() {
    Map<String, IntegrationManagement> managed = this.applicationContext
            .getBeansOfType(IntegrationManagement.class);
    for (Entry<String, IntegrationManagement> entry : managed.entrySet()) {
        IntegrationManagement bean = entry.getValue();
        if (!bean.getOverrides().loggingConfigured) {
            bean.setLoggingEnabled(this.defaultLoggingEnabled);
        }//from w  w  w  .  j a va2  s .  c  om
        bean.registerMetricsCaptor(this.metricsCaptor);
    }
}

From source file:org.springframework.integration.support.management.IntegrationManagementConfigurer.java

@Override
public void afterSingletonsInstantiated() {
    Assert.state(this.applicationContext != null, "'applicationContext' must not be null");
    Assert.state(MANAGEMENT_CONFIGURER_NAME.equals(this.beanName),
            getClass().getSimpleName() + " bean name must be " + MANAGEMENT_CONFIGURER_NAME);
    if (this.metricsFactory == null && StringUtils.hasText(this.metricsFactoryBeanName)) {
        this.metricsFactory = this.applicationContext.getBean(this.metricsFactoryBeanName,
                MetricsFactory.class);
    }//from ww  w  . ja va 2s  . c  om
    if (this.metricsFactory == null) {
        this.metricsFactory = new DefaultMetricsFactory();
    }
    Map<String, IntegrationManagement> managed = this.applicationContext
            .getBeansOfType(IntegrationManagement.class);
    for (Entry<String, IntegrationManagement> entry : managed.entrySet()) {
        IntegrationManagement bean = entry.getValue();
        bean.setLoggingEnabled(this.defaultLoggingEnabled);
        if (bean instanceof MessageChannelMetrics) {
            configureChannelMetrics(entry.getKey(), (MessageChannelMetrics) bean);
        } else if (bean instanceof MessageHandlerMetrics) {
            configureHandlerMetrics(entry.getKey(), (MessageHandlerMetrics) bean);
        } else if (bean instanceof MessageSourceMetrics) {
            configureSourceMetrics(entry.getKey(), (MessageSourceMetrics) bean);
        }
    }
}