All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.icthh.xm.commons.web.spring.config.LogstashConfiguration Maven / Gradle / Ivy

package com.icthh.xm.commons.web.spring.config;

import com.icthh.xm.commons.logging.LogstashConfigurer;
import com.icthh.xm.commons.logging.LogstashConfigurer.XmLogstashConfig;
import tech.jhipster.config.JHipsterProperties;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

@Configuration
public class LogstashConfiguration {

    public LogstashConfiguration(@Value("${spring.application.name}") String appName,
                                 @Value("${server.port}") Integer appPort,
                                 @Value("${spring.cloud.consul.discovery.instanceId}") String instanceId,
                                 JHipsterProperties jhipsterProperties) {

        JHipsterProperties.Logging.Logstash logstash = jhipsterProperties.getLogging().getLogstash();

        XmLogstashConfig config = new XmLogstashConfig(appName,
                                                       appPort,
                                                       instanceId,
                                                       logstash.getHost(),
                                                       logstash.getPort(),
                                                       logstash.getRingBufferSize());
        LogstashConfigurer.initLogstash(config);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy