I am trying to implement a spring actuator for readiness and liveness,
so if I deploy it with enabled probe, a graceful shutdown occurs.
However, for other services with the same settings and dependencies it works well, as well as if I run service with actuator on localhost it works well. What should I check?
my configs
probes:
enabled: true
ready:
path: /actuator/health/readiness
port: 8080
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 3
successThreshold: 3
failureThreshold: 15
live:
path: /actuator/health/liveness
port: 8080
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 3
successThreshold: 3
failureThreshold: 15
I have tried different settings for actuator
18:19:33,559 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
18:19:33,560 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
18:19:33,561 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/app.jar!/BOOT-INF/lib/sbol2-lib-commons2-1.0.0-SNAPSHOT.jar!/logback.xml]
18:19:33,578 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList#30c7da1e - URL [jar:file:/app.jar!/BOOT-INF/lib/sbol2-lib-commons2-1.0.0-SNAPSHOT.jar!/logback.xml] is not of type file
18:19:33,889 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
18:19:33,894 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [consoleAppender]
18:19:34,072 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.LoggingEventJsonProviders] for [providers] property
18:19:34,173 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.LoggingEventFormattedTimestampJsonProvider] for [timestamp] property
18:19:34,175 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.LogLevelJsonProvider] for [logLevel] property
18:19:34,176 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.ThreadNameJsonProvider] for [threadName] property
18:19:34,178 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.LoggerNameJsonProvider] for [loggerName] property
18:19:34,180 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.MdcJsonProvider] for [mdc] property
18:19:34,183 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.StackTraceJsonProvider] for [stackTrace] property
18:19:34,186 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.StackHashJsonProvider] for [stackHash] property
18:19:34,189 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.LoggingEventPatternJsonProvider] for [pattern] property
18:19:34,770 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to ALL
18:19:34,770 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [consoleAppender] to Logger[ROOT]
18:19:34,771 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
18:19:34,772 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator#3ecd23d9 - Registering current configuration as safe fallback point
{"#timestamp":"2022-10-20T18:19:35.182+06:00","level":"TRACE","thread_name":"main","logger_name":"o.s.c.i.s.SpringFactoriesLoader","message":"Loaded [org.springframework.boot.logging.LoggingSystemFactory] names: [org.springframework.boot.logging.logback.LogbackLoggingSystem.Factory, org.springframework.boot.logging.log4j2.Log4J2LoggingSystem.Factory, org.springframework.boot.logging.java.JavaLoggingSystem.Factory]"}
18:19:36,597 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList#bd4dc25 - URL [jar:file:/app.jar!/BOOT-INF/lib/sbol2-lib-commons2-1.0.0-SNAPSHOT.jar!/logback.xml] is not of type file
18:19:36,658 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
18:19:36,659 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [consoleAppender]
18:19:36,665 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.LoggingEventJsonProviders] for [providers] property
18:19:36,665 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.LoggingEventFormattedTimestampJsonProvider] for [timestamp] property
18:19:36,665 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.LogLevelJsonProvider] for [logLevel] property
18:19:36,666 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.ThreadNameJsonProvider] for [threadName] property
18:19:36,666 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.LoggerNameJsonProvider] for [loggerName] property
18:19:36,666 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.MdcJsonProvider] for [mdc] property
18:19:36,667 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.StackTraceJsonProvider] for [stackTrace] property
18:19:36,667 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.StackHashJsonProvider] for [stackHash] property
18:19:36,668 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.LoggingEventPatternJsonProvider] for [pattern] property
18:19:36,670 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to ALL
18:19:36,670 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator#f736069 - Propagating ALL level on Logger[ROOT] onto the JUL framework
18:19:36,671 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [consoleAppender] to Logger[ROOT]
18:19:36,671 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
18:19:36,671 |-INFO in org.springframework.boot.logging.logback.SpringBootJoranConfigurator#4229bb3f - Registering current configuration as safe fallback point
{"#timestamp":"2022-10-20T18:19:36.677+06:00","level":"TRACE","thread_name":"main","logger_name":"o.s.beans.BeanUtils","message":"No property editor [org.springframework.boot.logging.LogLevelEditor] found for type org.springframework.boot.logging.LogLevel according to 'Editor' suffix convention"}
18:19:36,680 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator#f736069 - Propagating INFO level on Logger[ROOT] onto the JUL framework
{"#timestamp":"2022-10-20T18:19:37.157+06:00","level":"INFO","thread_name":"main","logger_name":"k.s.s.a.l.LimitsApplication","message":"Starting LimitsApplication v1.0.13 using Java 15.0.2 on limits-5c859d4dbb-w642r with PID 1 (/app.jar started by 1000630000 in /)"}
{"#timestamp":"2022-10-20T18:19:37.159+06:00","level":"INFO","thread_name":"main","logger_name":"k.s.s.a.l.LimitsApplication","message":"The following profiles are active: ift"}
{"#timestamp":"2022-10-20T18:19:40.777+06:00","level":"INFO","thread_name":"main","logger_name":"o.s.d.r.c.RepositoryConfigurationDelegate","message":"Bootstrapping Spring Data JPA repositories in DEFAULT mode."}
{"#timestamp":"2022-10-20T18:19:41.484+06:00","level":"INFO","thread_name":"main","logger_name":"o.s.d.r.c.RepositoryConfigurationDelegate","message":"Finished Spring Data repository scanning in 694 ms. Found 9 JPA repository interfaces."}
{"#timestamp":"2022-10-20T18:19:44.194+06:00","level":"INFO","thread_name":"main","logger_name":"c.u.j.c.EnableEncryptablePropertiesBeanFactoryPostProcessor","message":"Post-processing PropertySource instances"}
{"#timestamp":"2022-10-20T18:19:44.296+06:00","level":"INFO","thread_name":"main","logger_name":"c.u.j.EncryptablePropertySourceConverter","message":"Converting PropertySource configurationProperties [org.springframework.boot.context.properties.source.ConfigurationPropertySourcesPropertySource] to AOP Proxy"}
{"#timestamp":"2022-10-20T18:19:44.298+06:00","level":"INFO","thread_name":"main","logger_name":"c.u.j.EncryptablePropertySourceConverter","message":"Converting PropertySource systemProperties [org.springframework.core.env.PropertiesPropertySource] to EncryptableMapPropertySourceWrapper"}
{"#timestamp":"2022-10-20T18:19:44.298+06:00","level":"INFO","thread_name":"main","logger_name":"c.u.j.EncryptablePropertySourceConverter","message":"Converting PropertySource systemEnvironment [org.springframework.boot.env.SystemEnvironmentPropertySourceEnvironmentPostProcessor$OriginAwareSystemEnvironmentPropertySource] to EncryptableSystemEnvironmentPropertySourceWrapper"}
{"#timestamp":"2022-10-20T18:19:44.299+06:00","level":"INFO","thread_name":"main","logger_name":"c.u.j.EncryptablePropertySourceConverter","message":"Converting PropertySource random [org.springframework.boot.env.RandomValuePropertySource] to EncryptablePropertySourceWrapper"}
{"#timestamp":"2022-10-20T18:19:44.299+06:00","level":"INFO","thread_name":"main","logger_name":"c.u.j.EncryptablePropertySourceConverter","message":"Converting PropertySource Config resource 'class path resource [application-ift.yaml]' via location 'optional:classpath:/' [org.springframework.boot.env.OriginTrackedMapPropertySource] to EncryptableMapPropertySourceWrapper"}
{"#timestamp":"2022-10-20T18:19:44.299+06:00","level":"INFO","thread_name":"main","logger_name":"c.u.j.EncryptablePropertySourceConverter","message":"Converting PropertySource Config resource 'class path resource [application.yaml]' via location 'optional:classpath:/' [org.springframework.boot.env.OriginTrackedMapPropertySource] to EncryptableMapPropertySourceWrapper"}
{"#timestamp":"2022-10-20T18:19:44.483+06:00","level":"INFO","thread_name":"main","logger_name":"c.u.j.f.DefaultLazyPropertyFilter","message":"Property Filter custom Bean not found with name 'encryptablePropertyFilter'. Initializing Default Property Filter"}
{"#timestamp":"2022-10-20T18:19:45.901+06:00","level":"INFO","thread_name":"main","logger_name":"c.u.j.r.DefaultLazyPropertyResolver","message":"Property Resolver custom Bean not found with name 'encryptablePropertyResolver'. Initializing Default Property Resolver"}
{"#timestamp":"2022-10-20T18:19:45.974+06:00","level":"INFO","thread_name":"main","logger_name":"c.u.j.d.DefaultLazyPropertyDetector","message":"Property Detector custom Bean not found with name 'encryptablePropertyDetector'. Initializing Default Property Detector"}
{"#timestamp":"2022-10-20T18:19:46.597+06:00","level":"INFO","thread_name":"main","logger_name":"o.s.b.w.e.t.TomcatWebServer","message":"Tomcat initialized with port(s): 9090 (http)"}
{"#timestamp":"2022-10-20T18:19:46.662+06:00","level":"INFO","thread_name":"main","logger_name":"o.a.c.http11.Http11NioProtocol","message":"Initializing ProtocolHandler [\"http-nio-9090\"]"}
{"#timestamp":"2022-10-20T18:19:46.662+06:00","level":"INFO","thread_name":"main","logger_name":"o.a.c.core.StandardService","message":"Starting service [Tomcat]"}
{"#timestamp":"2022-10-20T18:19:46.663+06:00","level":"INFO","thread_name":"main","logger_name":"o.a.c.core.StandardEngine","message":"Starting Servlet engine: [Apache Tomcat/9.0.48]"}
{"#timestamp":"2022-10-20T18:19:47.993+06:00","level":"INFO","thread_name":"main","logger_name":"o.h.j.internal.util.LogHelper","message":"HHH000204: Processing PersistenceUnitInfo [name: default]"}
{"#timestamp":"2022-10-20T18:19:48.185+06:00","level":"INFO","thread_name":"main","logger_name":"org.hibernate.Version","message":"HHH000412: Hibernate ORM core version 5.4.32.Final"}
{"#timestamp":"2022-10-20T18:19:48.506+06:00","level":"INFO","thread_name":"main","logger_name":"o.h.annotations.common.Version","message":"HCANN000001: Hibernate Commons Annotations {5.1.2.Final}"}
{"#timestamp":"2022-10-20T18:19:48.786+06:00","level":"WARN","thread_name":"main","logger_name":"com.zaxxer.hikari.HikariConfig","message":"HikariPool-1 - leakDetectionThreshold is less than 2000ms or more than maxLifetime, disabling it."}
{"#timestamp":"2022-10-20T18:19:48.787+06:00","level":"WARN","thread_name":"main","logger_name":"com.zaxxer.hikari.HikariConfig","message":"HikariPool-1 - idleTimeout has been set but has no effect because the pool is operating as a fixed size pool."}
{"#timestamp":"2022-10-20T18:19:48.787+06:00","level":"INFO","thread_name":"main","logger_name":"c.z.hikari.HikariDataSource","message":"HikariPool-1 - Starting..."}
{"#timestamp":"2022-10-20T18:19:49.595+06:00","level":"INFO","thread_name":"main","logger_name":"c.z.hikari.HikariDataSource","message":"HikariPool-1 - Start completed."}
{"#timestamp":"2022-10-20T18:19:49.806+06:00","level":"INFO","thread_name":"main","logger_name":"org.hibernate.dialect.Dialect","message":"HHH000400: Using dialect: org.hibernate.dialect.Oracle12cDialect"}
{"#timestamp":"2022-10-20T18:19:50.771+06:00","level":"INFO","thread_name":"main","logger_name":"o.h.e.b.i.EnversServiceImpl","message":"Envers integration enabled? : true"}
{"#timestamp":"2022-10-20T18:19:52.074+06:00","level":"INFO","thread_name":"main","logger_name":"o.h.v.internal.util.Version","message":"HV000001: Hibernate Validator 6.2.0.Final"}
{"#timestamp":"2022-10-20T18:19:55.159+06:00","level":"INFO","thread_name":"main","logger_name":"o.h.e.t.j.p.i.JtaPlatformInitiator","message":"HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]"}
{"#timestamp":"2022-10-20T18:19:55.173+06:00","level":"INFO","thread_name":"main","logger_name":"o.s.o.j.LocalContainerEntityManagerFactoryBean","message":"Initialized JPA EntityManagerFactory for persistence unit 'default'"}
{"#timestamp":"2022-10-20T18:20:08.260+06:00","level":"INFO","thread_name":"main","logger_name":"o.s.b.w.e.t.TomcatWebServer","message":"Tomcat started on port(s): 9090 (http) with context path ''"}
{"#timestamp":"2022-10-20T18:20:08.470+06:00","level":"INFO","thread_name":"main","logger_name":"o.s.b.w.e.t.TomcatWebServer","message":"Tomcat initialized with port(s): 8080 (http)"}
{"#timestamp":"2022-10-20T18:20:08.502+06:00","level":"INFO","thread_name":"main","logger_name":"o.s.b.a.e.w.EndpointLinksResolver","message":"Exposing 2 endpoint(s) beneath base path '/actuator'"}
{"#timestamp":"2022-10-20T18:20:08.703+06:00","level":"INFO","thread_name":"main","logger_name":"o.s.b.w.e.t.TomcatWebServer","message":"Tomcat started on port(s): 8080 (http) with context path ''"}
{"#timestamp":"2022-10-20T18:20:10.382+06:00","level":"INFO","thread_name":"main","logger_name":"k.s.s.a.l.LimitsApplication","message":"Started LimitsApplication in 35.283 seconds (JVM running for 37.72)"}
{"#timestamp":"2022-10-20T18:20:10.472+06:00","level":"INFO","thread_name":"main","logger_name":"k.sber.sbol2.app.limits.Runner","message":"Limits is running..."}
{"#timestamp":"2022-10-20T18:20:10.475+06:00","level":"INFO","thread_name":"SpringApplicationShutdownHook","logger_name":"o.s.b.w.e.t.GracefulShutdown","message":"Commencing graceful shutdown. Waiting for active requests to complete"}
{"#timestamp":"2022-10-20T18:20:10.487+06:00","level":"INFO","thread_name":"tomcat-shutdown","logger_name":"o.s.b.w.e.t.GracefulShutdown","message":"Graceful shutdown complete"}
{"#timestamp":"2022-10-20T18:20:10.563+06:00","level":"INFO","thread_name":"SpringApplicationShutdownHook","logger_name":"o.s.b.w.e.t.GracefulShutdown","message":"Commencing graceful shutdown. Waiting for active requests to complete"}
{"#timestamp":"2022-10-20T18:20:10.570+06:00","level":"INFO","thread_name":"tomcat-shutdown","logger_name":"o.s.b.w.e.t.GracefulShutdown","message":"Graceful shutdown complete"}
{"#timestamp":"2022-10-20T18:20:12.778+06:00","level":"INFO","thread_name":"SpringApplicationShutdownHook","logger_name":"o.s.o.j.LocalContainerEntityManagerFactoryBean","message":"Closing JPA EntityManagerFactory for persistence unit 'default'"}
{"#timestamp":"2022-10-20T18:20:12.781+06:00","level":"INFO","thread_name":"SpringApplicationShutdownHook","logger_name":"c.z.hikari.HikariDataSource","message":"HikariPool-1 - Shutdown initiated..."}
{"#timestamp":"2022-10-20T18:20:13.013+06:00","level":"INFO","thread_name":"SpringApplicationShutdownHook","logger_name":"c.z.hikari.HikariDataSource","message":"HikariPool-1 - Shutdown completed."}
Normal Scheduled 8m42s default-scheduler Successfully assigned x/limits-5c859d4dbb-p5jgt to ocp-t-w002
Normal AddedInterface 8m41s multus Add eth0 [10.111.6.127/24] from openshift-sdn
Normal Pulled 8m38s kubelet Successfully pulled image "nexus.x.x/x/limits:1.0.13" in 2.961535874s
Normal Killing 8m13s kubelet Container limits failed liveness probe, will be restarted
Warning Unhealthy 8m13s (x3 over 8m33s) kubelet Liveness probe failed: Get "http://10.111.6.127:8080/actuator/health/liveness": dial tcp 10.111.6.127:8080: connect: connection refused
Normal Pulling 7m43s (x2 over 8m41s) kubelet Pulling image "nexus.x.x:x/x/limits:1.0.13"
Normal Pulled 7m43s kubelet Successfully pulled image "nexus.x:x/x/limits:1.0.13" in 23.406574ms
Normal Created 7m42s (x2 over 8m38s) kubelet Created container limits
Normal Started 7m42s (x2 over 8m37s) kubelet Started container limits
Warning Unhealthy 3m41s (x51 over 8m36s) kubelet Readiness probe failed: Get "http://10.111.6.127:8080/actuator/health/readiness": dial tcp 10.111.6.127:8080:
I try to execute the thingsboard performance test
Thingsboard performance tests
$ sudo docker run -it --env-file .env --name tb-perf-test thingsboard/tb-performance-test
but I get this result, anyone can help, please
Starting ThingsBoard Performance Tests...
16:57:11,071 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
16:57:11,071 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
16:57:11,071 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/usr/share/tb-performance-tests/conf/logback.xml]
16:57:11,085 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs multiple times on the classpath.
16:57:11,085 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [file:/usr/share/tb-performance-tests/conf/logback.xml]
16:57:11,085 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:/usr/share/tb-performance-tests/bin/tb-performance-tests.jar!/BOOT-INF/classes!/logback.xml]
16:57:11,502 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
16:57:11,579 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
16:57:11,588 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
16:57:11,692 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - This appender no longer admits a layout as a sub-component, set an encoder instead.
16:57:11,692 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - To ensure compatibility, wrapping your layout in LayoutWrappingEncoder.
16:57:11,692 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - See also http://logback.qos.ch/codes.html#layoutInsteadOfEncoder for details
16:57:11,693 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.thingsboard] to INFO
16:57:11,693 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO
16:57:11,693 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
16:57:11,694 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
16:57:11,708 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator#5387f9e0 - Registering current configuration as safe fallback point
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
16:57:21.391 [main] ERROR o.s.boot.SpringApplication - Application startup failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'testExecutor': Unsatisfied dependency expressed through field 'deviceAPITest'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'deviceMqttAPITest': Invocation of init method failed; nested exception is org.springframework.web.client.ResourceAccessException: I/O error on POST request for "http://localhost:8080/api/auth/login": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused)
Maybe you are using port 9090, while your deployment uses 8080.
I have a storm project for which I have added some custom logback configurations using logback.xml (added configs to write logs to an index). When I build the jar and deploy the same on the cluster, I get the multiple bindings errors for this class StaticLoggerBinder.class due to it being present both in my jar and storm's own dependency list. Below is the error
SLF4J: Found binding in [jar:file:/usr/lib/storm/apache-storm-1.2.2/lib/log4j-slf4j-impl-2.8.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/app/test/test-storm-0.0.1-SNAPSHOT-jar-with-dependencies.jar!/org/slf4j/impl/StaticLoggerBinder.class]
This causes none of my custom configs to be picked up.
When I remove the conflicting jar from Storm's lib folder, my logback.xml configs are reflected and my logs are written to the index with no issues. I also see these logs in the beginning when I deploy the topology showing the configs I have added
22:05:13,818 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/app/test/test-storm-0.0.55-SNAPSHOT-jar-with-dependencies.jar!/logback.xml]
22:05:13,839 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList#19bb089b - URL [jar:file:/app/test/test-storm-0.0.1-SNAPSHOT-jar-with-dependencies.jar!/logback.xml] is not of type file
22:05:14,094 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
22:05:14,097 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [CONSOLE]
22:05:14,102 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
22:05:14,125 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [com.splunk.logging.HttpEventCollectorLogbackAppender]
22:05:14,126 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [SPLUNK]
22:05:14,132 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.test] to INFO
22:05:14,132 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger [com.test] to false
22:05:14,132 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [SPLUNK] to Logger[com.test]
22:05:14,133 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [CONSOLE] to Logger[com.test]
22:05:14,133 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO
22:05:14,133 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [CONSOLE] to Logger[ROOT]
22:05:14,133 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
However, I do not want to take this route since it cannot be maintained so I decided use the maven-shade-plugin to relocate the org.slf4j.impl to org.shaded.slf4j.impl. Now when I deploy the topology there is no multiple bindings anymore, however my logback.xml is not honored and none of my configs are reflected nor do I see the above messages. It probably falls back to using a different logger.
How can I make my configs to be reflected when I deploy the topology? Please help. (Storm Version 1.2.2)
Storm switched from Logback to Log4j2 a few years ago. You can configure Log4j2 via the storm/log4j2/worker.xml and storm/log4j2/cluster.xml files. The former configures logging for your topology, as well as the worker JVM.
You should exclude logback from your fat jar.
Please also see this answer https://stackoverflow.com/a/50229035/8845188.
I have java spring boot project(for web server), and it works find.
After that, I added spark depencies on this project, and it build without error.
In gradle
compile group: 'org.apache.spark', name: 'spark-core_2.11', version: '2.0.1'
compile group: 'org.apache.spark', name: 'spark-sql_2.11', version: '2.0.1'
BUT everytime spring web server got request, web server kept re-compiling itself.
some request output
|------------|------------|-----|------------|
// WHEN REQEUST GOT INTO, SPRING IS CLOSED AND RESTARTED ITSELF. WHY?????
17:26:19.052 INFO o.s.b.c.e.AnnotationConfigEmbeddedWebApplicationContext [] - [ : ]Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#722b17b0: startup date [Mon Nov 21 17:26:02 KST 2016]; root of context hierarchy
17:26:19.055 INFO o.s.j.e.a.AnnotationMBeanExporter [] - [ : ]Unregistering JMX-exposed beans on shutdown
17:26:19,607 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
17:26:19,607 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [SQLFileAppender]
17:26:19,615 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - No compression will be used
17:26:19,615 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use the pattern log/sql.%d{yyyy-MM-dd}.log for the active file
17:26:19,616 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - The date pattern is 'yyyy-MM-dd' from file name pattern 'log/sql.%d{yyyy-MM-dd}.log'.
17:26:19,616 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Roll-over at midnight.
17:26:19,616 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Setting initial period to Mon Nov 21 17:26:19 KST 2016
17:26:19,618 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
17:26:19,622 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[SQLFileAppender] - Active log file name: log/sql.2016-11-21.log
17:26:19,623 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[SQLFileAppender] - File property is set to [null]
17:26:19,623 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
17:26:19,623 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [ControllerFileAppender]
17:26:19,623 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - No compression will be used
17:26:19,624 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use the pattern log/controller.%d{yyyy-MM-dd}.log for the active file
17:26:19,624 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - The date pattern is 'yyyy-MM-dd' from file name pattern 'log/controller.%d{yyyy-MM-dd}.log'.
17:26:19,624 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Roll-over at midnight.
17:26:19,624 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Setting initial period to Mon Nov 21 17:26:19 KST 2016
17:26:19,624 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
17:26:19,625 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[ControllerFileAppender] - Active log file name: log/controller.2016-11-21.log
17:26:19,625 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[ControllerFileAppender] - File property is set to [null]
17:26:19,625 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
17:26:19,625 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [console]
17:26:19,628 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO
17:26:19,629 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator#be00188 - Propagating INFO level on Logger[ROOT] onto the JUL framework
17:26:19,630 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [console] to Logger[ROOT]
17:26:19,630 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [jdbc] to OFF
17:26:19,630 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator#be00188 - Propagating OFF level on Logger[jdbc] onto the JUL framework
17:26:19,630 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [jdbc.sqltiming] to INFO
17:26:19,630 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator#be00188 - Propagating INFO level on Logger[jdbc.sqltiming] onto the JUL framework
17:26:19,630 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [SQLFileAppender] to Logger[jdbc.sqltiming]
17:26:19,630 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [jdbc.resultsettable] to INFO
17:26:19,630 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator#be00188 - Propagating INFO level on Logger[jdbc.resultsettable] onto the JUL framework
17:26:19,630 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [Controller] to INFO
17:26:19,630 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator#be00188 - Propagating INFO level on Logger[Controller] onto the JUL framework
17:26:19,630 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [ControllerFileAppender] to Logger[Controller]
17:26:19,630 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
17:26:19,630 |-INFO in org.springframework.boot.logging.logback.SpringBootJoranConfigurator#6917246 - Registering current configuration as safe fallback point
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.3.2.RELEASE)
We have a spring-boot 1.0.RC1 application, with logback configured for logging and a logback.xml file in src/test/resources. When we run spring-boot from maven, the logback file seems to be seen and respected. (That's our required logging format after the spring-boot logo)
D:\Users\myName\My Projects\Work\my-co\my-app\src\my-app\my-app-camel>mvn clean spring-boot:run -Dlogback.statusListenerClass=ch.qos.logback.core.status.OnConsoleStatusListener -Dlogback.configurationFile=src/test/resources/logback.xml
<snip/>
[INFO] --- spring-boot-maven-plugin:0.5.0.M7:run (default-cli) # my-app-camel ---
06:41:56,011 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [src/test/resources/logback.xml] at [file:/D:/Users/myName/My%20Projects/Work/my-co/my-app/src/my-app/my-app-camel/src/test/resources/logback.xml]
06:41:56,150 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
06:41:56,170 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Setting ReconfigureOnChangeFilter scanning period to 5 seconds
06:41:56,171 |-INFO in ReconfigureOnChangeFilter{invocationCounter=0} - Will scan for changes in [[D:\Users\myName\My Projects\Work\my-co\my-app\src\my-app\my-app-camel\src\test\resources\logback.xml]] every 5 seconds.
06:41:56,172 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Adding ReconfigureOnChangeFilter as a turbo filter
06:41:56,223 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
06:41:56,233 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
06:41:56,276 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
06:41:56,389 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [me.moocar.logbackgelf.GelfAppender]
06:41:56,398 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [GELF]
06:41:56,567 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.my-co.my-app.] to DEBUG
06:41:56,568 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger [com.my-co.my-app.] to false
06:41:56,569 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[com.my-co.my-app.]
06:41:56,571 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.] to DEBUG
06:41:56,572 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger [org.] to false
06:41:56,572 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[org.]
06:41:56,573 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO
06:41:56,574 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
06:41:56,574 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
06:41:56,578 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator#4ffdcca5 - Registering current configuration as safe fallback point
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.0.0.RC1)
06:41:57.436 [com.my-co.my-app.Application.main()] INFO com.my-co.my-app.Application - Starting Application on MY-LAPTOP-HOSTNAME with PID 7812 (started by myName)
06:41:57.952 [com.my-co.my-app.Application.main()] INFO o.s.b.f.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [META-INF/spring/camel-server.xml]
<etc./>
However, when we remove a rogue logback.xml file which snuck into src/java/resources and re-run with everything else unchanged (making sure we clean to remove the one in target too):
D:\Users\myName\My Projects\Work\my-co\my-app\src\my-app\my-app-camel>mvn clean spring-boot:run -Dlogback.statusListenerClass=ch.qos.logback.core.status.OnConsoleStatusListener -Dlogback.configurationFile=src/test/resources/logback.xml
<snip/>
[INFO]
[INFO] <<< spring-boot-maven-plugin:1.0.0.RC1:run (default-cli) # my-app-camel <<<
[INFO]
[INFO] --- spring-boot-maven-plugin:1.0.0.RC1:run (default-cli) # my-app-camel ---
06:53:59,598 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [src/test/resources/logback.xml] at [file:/D:/Users/myName/My%20Projects/Work/my-co/my-app/src/my-app/my-app-camel/src/test/resources/logback.xml]
06:53:59,736 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
06:53:59,755 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Setting ReconfigureOnChangeFilter scanning period to 5 seconds
06:53:59,756 |-INFO in ReconfigureOnChangeFilter{invocationCounter=0} - Will scan for changes in [[D:\Users\myName\My Projects\Work\my-co\my-app\src\my-app\my-app-camel\src\test\resources\logback.xml]] every 5 seconds.
06:53:59,757 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Adding ReconfigureOnChangeFilter as a turbo filter
06:53:59,806 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
06:53:59,817 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
06:53:59,858 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
06:53:59,971 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [me.moocar.logbackgelf.GelfAppender]
06:53:59,980 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [GELF]
06:54:00,144 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.my-co.my-app.] to DEBUG
06:54:00,144 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger [com.my-co.my-app.] to false
06:54:00,145 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[com.my-co.my-app.]
06:54:00,148 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.] to DEBUG
06:54:00,148 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger [org.] to false
06:54:00,149 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[org.]
06:54:00,150 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to DEBUG
06:54:00,150 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
06:54:00,151 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
06:54:00,154 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator#54c1f582 - Registering current configuration as safe fallback point
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.0.0.RC1)
2014-02-12 06:54:01.023 INFO 5240 --- [lication.main()] com.my-co.my-app.Application : Starting Application on MY-LAPTOP-HOSTNAME with PID 5240 (started by myName)
2014-02-12 06:54:01.564 INFO 5240 --- [lication.main()] o.s.b.f.xml.XmlBeanDefinitionReader : Loading XML bean definitions from class path resource [META-INF/spring/camel-server.xml]
<etc./>
You'll notice that the logging format after spring-boot starts is different from the first output. However, logback (prior to Spring-Boot starting) reports it's seen the logback.xml in src/test/resources, just like it did the first time.
For interest, our logback.xml (which was in both src/java/resources and src/test/resources is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="5 seconds">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{40} - %msg%n</pattern>
</encoder>
</appender>
<appender name="GELF" class="me.moocar.logbackgelf.GelfAppender">
<facility>logback-gelf-test</facility>
<graylog2ServerHost>XXX.XXX.XXX.XXX</graylog2ServerHost>
<graylog2ServerPort>NNNNN</graylog2ServerPort>
<useLoggerName>true</useLoggerName>
<useThreadName>true</useThreadName>
<useMarker>true</useMarker>
<graylog2ServerVersion>0.9.6</graylog2ServerVersion>
<chunkThreshold>1000</chunkThreshold>
<messagePattern>%m%rEx</messagePattern>
<shortMessagePattern>%.-100(%m%rEx)</shortMessagePattern>
<additionalField>ipAddress:_ip_address</additionalField>
<additionalField>requestId:_request_id</additionalField>
<staticAdditionalField>_node_name:www013</staticAdditionalField>
<includeFullMDC>true</includeFullMDC>
</appender>
<logger name="com.my-co.my-app." level="DEBUG" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
<logger name="org." level="DEBUG" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
<root level="INFO">
<appender-ref ref="STDOUT" />
<!--<appender-ref ref="GELF" />-->
</root>
</configuration>
So in summary, it seems (though I might be wrong) that when a logback.xml is bundled with my spring-boot app it is seen and used (i.e. in src/java/resources), but when we don't bundle, then despite logback's best efforts it's ignored.
As for fixing this, we're stumped. We're guessing that there is something somewhere in our spring-boot jar which is somehow taking precedence, or turning off logback, or stepping in and telling logback to ignore what it's just been told and to use another default.
Alternatively we're being dumb, but can't see it. All help gratefully received.
The default strategy assumes that if you don't have a logback.xml (or one of the other standard file names) in the classpath then you must be happy with the defaults (see LogbackLoggingSystem for details). Spring Boot tries to unify the external configuration switches for common logging sytems, so it looks in logging.config (it didn't know about logback.configurationFile). You could use that instead (i.e. logging.config=file:./src/test/resources/logback.xml), or make sure your config file is on the classpath.
I know this post is a bit old but adding the following to application.properties is a quick workaround based on Dave Syer's answer:
logging.config=${logback.configurationFile}
According to Spring Boot documentation, you could run like this:
java -jar app.jar --logging.config=./src/test/resources/logback.xml
Additionally, Spring Boot tries to unify the properties name of the different log startegies. As a result, the JVM parameter Dlogback.configurationFile is not used for Spring Boot.
If logback xml is under resources folder, you can add following to VM option:
java -jar App.jar -Dlogging.config=classpath:logback-local.xml
Add logback file path in application.properties file . Example test folder contains app.jar and config folder as below
test
|- app.jar
|- config
|--- application.properties
|--- logback.xml
Then add logging.config:config\\logback.xml. Then try , it will work
Assuming you have spring logback configurations in config directory, the command below will add external file by overriding the existing file (if any) inside the application:
java -jar -Dlogging.config=./config/logback-spring.xml app.jar
--spring.config.location=./config/application.properties
Not quite right. logback.configurationFile is not managed by Spring (i.e. env var replacement or so), but logback will still pick it up. At least that's my understanding of the docs and my practical experience.