SpringBoot应用程序多次启动,并与Logstash断开连接 [英] SpringBoot app starts multiple times and disconnects from logstash

查看:368
本文介绍了SpringBoot应用程序多次启动,并与Logstash断开连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用./mvnw在docker上运行的springboot应用程序(Spring Boot v1.3.5.RELEASE);

I have an springboot application (Spring Boot v1.3.5.RELEASE) that is run on docker with ./mvnw;

它会在1-2分钟后重新启动",并且在第二次启动后,它们不会将任何日志发送到logstash.

it "restarts" after 1-2 minutes and after second start they don't send any log to logstash..

首先,我们在下面的日志中看到

in first start we see below log

2016-07-27 08:54:29,616 DEBUG [background-preinit] logging: Logging Provider: org.jboss.logging.Slf4jLoggerProvider found via system property

在第二个日志记录提供程序日志丢失后出现

bug.

bug after the second one logging provider log is missing..

    **2016-07-27 08:54:25,386 INFO  [restartedMain] DemoApp: Starting DemoApp on 7adf92b8bc96 with PID 85 (/home/infoowl/project/target/classes started by infoowl in /home/infoowl/project)**
    2016-07-27 08:54:25,471 DEBUG [restartedMain] DemoApp: Running with Spring Boot v1.3.5.RELEASE, Spring v4.2.6.RELEASE
    2016-07-27 08:54:25,487 INFO  [restartedMain] DemoApp: The following profiles are active: dev
    2016-07-27 08:54:29,616 DEBUG [background-preinit] logging: Logging Provider: org.jboss.logging.Slf4jLoggerProvider found via system property
    2016-07-27 08:54:32,436 INFO  [restartedMain] DemoApp: Started DemoApp in 9.865 seconds (JVM running for 14.572)
    2016-07-27 08:54:45,937 DEBUG [restartedMain] HttpURLConnection: sun.net.www.MessageHeader@3959b7066 pairs: {GET /config/transformation/dev/master HTTP/1.1: null}{Accept: application/json, application/*+json}{Authorization: Basic YWRtaW46YWRtaW4=}{User-Agent: Java/1.8.0_91}{Host: registry:8761}{Connection: keep-alive}
    2016-07-27 08:54:46,512 DEBUG [restartedMain] HttpURLConnection: sun.net.www.MessageHeader@12bba63311 pairs: {null: HTTP/1.1 200 OK}{Server: Apache-Coyote/1.1}{X-Content-Type-Options: nosniff}{X-XSS-Protection: 1; mode=block}{Cache-Control: no-cache, no-store, max-age=0, must-revalidate}{Pragma: no-cache}{Expires: 0}{X-Application-Context: jhipster-registry:dev,native:8761}{Content-Type: application/json;charset=UTF-8}{Transfer-Encoding: chunked}{Date: Wed, 27 Jul 2016 08:54:46 GMT}
    2016-07-27 08:54:46,777 INFO  [restartedMain] DemoApp: The following profiles are active: dev
    2016-07-27 08:55:01,347 WARN  [restartedMain] ConfigurationClassPostProcessor: Cannot enhance @Configuration bean definition 'refreshScope' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.
    2016-07-27 08:55:03,767 DEBUG [restartedMain] AsyncConfiguration: Creating Async Task Executor
    2016-07-27 08:55:07,072 DEBUG [restartedMain] MetricsConfiguration: Registering JVM gauges
    2016-07-27 08:55:07,169 DEBUG [restartedMain] MetricsConfiguration: Initializing Metrics JMX reporting
    2016-07-27 08:55:07,281 INFO  [restartedMain] MetricsConfiguration: Initializing Metrics Log reporting
    2016-07-27 08:55:16,352 INFO  [localhost-startStop-1] WebConfigurer: Web application configuration, using profiles: [dev]
    2016-07-27 08:55:16,359 DEBUG [localhost-startStop-1] WebConfigurer: Initializing Metrics registries
    2016-07-27 08:55:16,383 DEBUG [localhost-startStop-1] WebConfigurer: Registering Metrics Filter
    2016-07-27 08:55:16,400 DEBUG [localhost-startStop-1] WebConfigurer: Registering Metrics Servlet
    2016-07-27 08:55:16,402 INFO  [localhost-startStop-1] WebConfigurer: Web application fully configured
    2016-07-27 08:55:19,343 INFO  [localhost-startStop-1] CoreApp: Running with Spring profile(s) : [dev]
    2016-07-27 08:55:24,670 INFO  [restartedMain] LoggingConfiguration: Initializing Logstash logging
    2016-07-27 08:55:24,781 INFO  [restartedMain] LoggingConfiguration: Logstash customFields: '{"app_name":"transformation","app_port":"9093","instance_id":"transformation:4afb19b3a2763ed887b8d69d246082e6"}', config: 'net.infoowl.hepsiburada.core.config.JHipsterProperties$Logging$Logstash@96d9ebe[enabled=true,host=elk-logstash,port=5000,queueSize=512]'
    2016-07-27 08:55:35,367 DEBUG [restartedMain] CacheConfiguration: No cache
    2016-07-27 08:55:40,071 DEBUG [restartedMain] DatabaseConfiguration: Configuring Mongeez
    2016-07-27 08:55:40,245 INFO  [restartedMain] FilesetXMLReader: Parsing XML Fileset file master.xml
    2016-07-27 08:55:40,275 INFO  [restartedMain] FilesetXMLReader: Num of changefiles found 0
    2016-07-27 08:55:41,089 DEBUG [restartedMain] SwaggerConfiguration: Starting Swagger
    2016-07-27 08:55:41,218 DEBUG [restartedMain] SwaggerConfiguration: Started Swagger in 118 ms
    2016-07-27 08:55:55,610 WARN  [restartedMain] URLConfigurationSource: No URLs will be polled as dynamic configuration sources.
    2016-07-27 08:55:56,975 WARN  [restartedMain] URLConfigurationSource: No URLs will be polled as dynamic configuration sources.
    2016-07-27 08:56:00,036 DEBUG [cron4j::scheduler[20b6349f63f32eea2d00877b000001562b91269c7714a479]::launcher[20b6349f63f32eea238ca33a000001562b9155042b804084]] CronPlugin: Found crontab config url org.crsh.vfs.Resource@7a65b25c
    **2016-07-27 08:56:00,788 INFO  [restartedMain] DemoApp: Starting DemoApp on 7adf92b8bc96 with PID 85 (/home/infoowl/project/target/classes started by infoowl in /home/infoowl/project)**
    2016-07-27 08:56:00,788 DEBUG [restartedMain] DemoApp: Running with Spring Boot v1.3.5.RELEASE, Spring v4.2.6.RELEASE
    2016-07-27 08:56:00,788 INFO  [restartedMain] DemoApp: The following profiles are active: dev
    2016-07-27 08:56:01,290 INFO  [restartedMain] DemoApp: Started DemoApp in 0.899 seconds (JVM running for 103.426)

另一观察..看到第二个起点仅仅是"0.899秒",这是不可能的..实际上,似乎第二个起点不是真正的起点,但logstash连接已消失..

another observation.. see second start is just "0.899 seconds" which is not possible.. Actually it seems second one is not a real start but logstash connection is gone..

第二次开始的原因可能是什么?我应该在哪里检查和调查;

What may be the reason for this second start? Where should I check and investigate;

推荐答案

我发现了问题,详细信息在这里; https://github.com/spring-cloud/spring-cloud-stream /issues/605

I found the problem, the details are here; https://github.com/spring-cloud/spring-cloud-stream/issues/605

这篇关于SpringBoot应用程序多次启动,并与Logstash断开连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆