Spring Boot AWS logging level - spring

I have several Spring Boot micro services that connect to Config Server and Eureka. All are running inside Docker container in ECS. They are very chatty and I would like to eliminate the non-critical messages.
2023-01-06 16:42:03.426 WARN 1 --- [tbeatExecutor-0]
c.n.d.s.t.d.RetryableEurekaHttpClient : Request execution failed with
message... 2023-01-06 16:43:28.082 INFO 1 --- [trap-executor-0]
c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via
configuration... 2023-01-06 16:50:03.679 INFO 1 --- [freshExecutor-0]
o.apache.http.impl.execchain.RetryExec... 2023-01-06 16:42:03.426 INFO
1 --- [tbeatExecutor-0] c.n.d.s.t.d.RedirectingEurekaHttpClient...
And each service has its application.properties file with the following:
logging.level.org.springframework.cloud.netflix.eureka.http=FATAL
logging.level.com.netflix.discovery=FATAL
logging.level.com.netflix.discovery.shared.resolver.aws = ERROR
logging.level.com.netflix.eureka.registry = ERROR
logging.level.org.springframework.web.servlet = FATAL
logging.level.org.hibernate = ERROR logging.level.com.zaxxer.hikari =
ERROR logging.level.org.apache.tomcat=ERROR
logging.level.org.apache.catalina=ERROR
But the messages continue to show up in the log files. I don't get why this is, since those messages are INFO and WARN.

In order to disable below error messages use the config below
logging.level.com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient=error
also in your config I see logging.level.org.springframework.web.servlet = FATAL logging.level.org.hibernate = this looks wrong, every line should have one gorup name = something, then new line.

Related

How to get resolve ElasticSearch warning message "Transport Handler Not Found" on spring boot application console?

We have two Spring boot applications using the same Elasticsearch database. The queries work fine. But the console of the second spring boot application is always flooded with these warning messages as soon as it boots up. Is there any configuration we are missing, either in the Spring boot app or at Elasticsearch?
2021-02-16 16:15:03.757 INFO 19828 --- [main] o.s.d.e.c.TransportClientFactoryBean: Adding transport node : 127.0.0.1:9300
2021-02-16 16:15:04.760 WARN 19828 --- [ient_boss][T#1]] o.e.transport.TransportService: Transport response handler not found of id [1]
2021-02-16 16:15:04.932 WARN 19828 --- [ient_boss][T#2]] o.e.transport.TransportService: Transport response handler not found of id [3]
2021-02-16 16:15:08.104 WARN 19828 --- [ient_boss][T#7]] o.e.transport.TransportService: Transport response handler not found of id [9]
2021-02-16 16:15:13.232 WARN 19828 --- [ient_boss][T#8]] o.e.transport.TransportService: Transport response handler not found of id [59]

Docker, Mongodb,Spring Boot on Windows getting Connection refused error

I am using default docker image of MongoDB and trying to connect using simple spring Boot application on windows box.
mongoDB image is getting stared correctly
IP in mongoDB image
I have spring-boot-starter-data-mongodb in my class path. i am using all spring boot default and only using below property in application.properties.
spring.data.mongodb.host=192.168.99.100
On application startup getting Connection refused: connect error
Logs
019-03-06 06:15:06.096 INFO 4664 --- [ main] org.mongodb.driver.cluster : Cluster created with settings {hosts=[192.168.99.100:27017], mode=MULTIPLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
2019-03-06 06:15:06.096 INFO 4664 --- [ main] org.mongodb.driver.cluster : Adding discovered server 192.168.99.100:27017 to client view of cluster
2019-03-06 06:15:06.356 WARN 4664 --- [ main] o.s.d.m.c.m.BasicMongoPersistentProperty : Customizing field name for id property not allowed! Custom name will not be considered!
2019-03-06 06:15:06.928 INFO 4664 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-03-06 06:15:07.164 INFO 4664 --- [68.99.100:27017] org.mongodb.driver.cluster : Exception in monitor thread while connecting to server 192.168.99.100:27017
What i am missing here ?
Not a MongoDB expert, but a moderate Docker user speaking: It looks like you are not publishing the port MongoDB runs by default: 27017. That's why your spring application could not get a connection and throws this exception:
Exception in monitor thread while connecting to server 192.168.99.100:27017
So you may try publishing the port by using -p 27017:27017when initiating mongo container.

com.couchbase.client.core.endpoint.kv.AuthenticationException: Authentication failure on Select Bucket command

I am having the below issue with CouchbaseVersion 5.5.1.
2018-11-01 12:36:51.452 WARN [promotion-customercriteria-ms,,,] [,] 1
--- [cb-io-1-2] c.c.client.core.endpoint.Endpoint : [][KeyValueEndpoint]: Authentication Failure. 2018-11-01 12:36:51.516 WARN [promotion-customercriteria-ms,,,] [,] 1 --- [cb-io-1-2] c.couchbase.client.core.RequestHandler : Received Error during Reconfiguration.
com.couchbase.client.core.endpoint.kv.AuthenticationException: Authentication failure on Select Bucket command at com.couchbase.client.core.endpoint.kv.KeyValueSelectBucketHandler.channelRead0(KeyValueSelectBucketHandler.java:151) at com.couchbase.client.core.endpoint.kv.KeyValueSelectBucketHandler.channelRead0(KeyValueSelectBucketHandler.java:41) at com.couchbase.client.deps.io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105 2018-11-01 12:36:51.540 WARN [promotion-customercriteria-ms,,,] [,] 1
--- [localhost-startStop-1] o.a.c.loader.WebappClassLoaderBase : The web application [ROOT] appears to have started a thread named [cb-computations-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
What can I do to fix this?
This is an old question but it could help others.
If you are using in the list of nodes other than data nodes, you should consider removing them from your configuration.
According to the java driver documentation, only the data nodes should be listed

Using spring cloud data flow , trying to deploy one simple job , but it stuck and deployment not completed

Following this.
I am trying to deploy one streaming job ,
But job got stuck and never deployed , but in the web UI , it has status "deployed"
2018-09-26 17:30:21.817 INFO 83184 --- [nio-9393-exec-5] o.s.c.d.s.s.AppDeployerStreamDeployer : Deploying application named [file] as part of stream named [Upper-Case-Stream-1] with resource URI [maven://org.springframework.cloud.stream.app:file-sink-rabbit:jar:1.3.1.RELEASE]
2018-09-26 17:30:22.738 INFO 83184 --- [nio-9393-exec-5] o.s.c.d.spi.local.LocalAppDeployer : Deploying app with deploymentId Upper-Case-Stream-1.file instance 0.
Logs will be in /var/folders/nr/yyxxzlcj1gqfwgbp7mn9l610q3vvqq/T/spring-cloud-dataflow-6132231081394360554/Upper-Case-Stream-1-1537963221817/Upper-Case-Stream-1.file
2018-09-26 17:30:22.747 INFO 83184 --- [nio-9393-exec-5] o.s.c.d.s.s.AppDeployerStreamDeployer : Deploying application named [transform] as part of stream named [Upper-Case-Stream-1] with resource URI [maven://org.springframework.cloud.stream.app:transform-processor-rabbit:jar:1.3.1.RELEASE]
2018-09-26 17:30:22.754 INFO 83184 --- [nio-9393-exec-5] o.s.c.d.spi.local.LocalAppDeployer : Deploying app with deploymentId Upper-Case-Stream-1.transform instance 0.
Logs will be in /var/folders/nr/yyxxzlcj1gqfwgbp7mn9l610q3vvqq/T/spring-cloud-dataflow-6132231081394360554/Upper-Case-Stream-1-1537963222747/Upper-Case-Stream-1.transform
2018-09-26 17:30:22.757 INFO 83184 --- [nio-9393-exec-5] o.s.c.d.s.s.AppDeployerStreamDeployer : Deploying application named [http] as part of stream named [Upper-Case-Stream-1] with resource URI [maven://org.springframework.cloud.stream.app:http-source-rabbit:jar:1.3.1.RELEASE]
2018-09-26 17:30:22.764 INFO 83184 --- [nio-9393-exec-5] o.s.c.d.spi.local.LocalAppDeployer : Deploying app with deploymentId Upper-Case-Stream-1.http instance 0.
Logs will be in /var/folders/nr/yyxxzlcj1gqfwgbp7mn9l610q3vvqq/T/spring-cloud-dataflow-6132231081394360554/Upper-Case-Stream-1-1537963222757/Upper-Case-Stream-1.http
It appears the Apps have been deployed, but it is unclear why do you think the stream is in a stuck state.
If the Apps aren't starting successfully, each of the application specific logs will include the details as to why.
Alternatively, when you deploy the stream with inheritLogging=true feature, you'd see all of the application logs as an aggregated output in the server console directly. It'd be a convenient method to debug locally; especially, when you're heavily on development mode.

spring-boot client unable to start with consul

I have setup and run consul using docker on my system using following command:
sudo docker run -p 8500:8500 consul:0.9.2
Consul is running fine as I can check from the consul UI (Image attached below):
Now, I am trying to run my spring-boot service to use this consul instance for service discovery and registration. But, whenever i start it gives me following exception:
2017-09-02 18:58:17.091 ERROR 5578 --- [ restartedMain] o.s.c.c.c.ConsulPropertySourceLocator : Fail fast is set and there was an error reading configuration from consul.
2017-09-02 18:58:18.183 ERROR 5578 --- [ restartedMain] o.s.c.c.c.ConsulPropertySourceLocator : Fail fast is set and there was an error reading configuration from consul.
2017-09-02 18:58:19.375 ERROR 5578 --- [ restartedMain] o.s.c.c.c.ConsulPropertySourceLocator : Fail fast is set and there was an error reading configuration from consul.
2017-09-02 18:58:20.691 ERROR 5578 --- [ restartedMain] o.s.c.c.c.ConsulPropertySourceLocator : Fail fast is set and there was an error reading configuration from consul.
2017-09-02 18:58:22.114 ERROR 5578 --- [ restartedMain] o.s.c.c.c.ConsulPropertySourceLocator : Fail fast is set and there was an error reading configuration from consul.
2017-09-02 18:58:23.671 ERROR 5578 --- [ restartedMain] o.s.c.c.c.ConsulPropertySourceLocator : Fail fast is set and there was an error reading configuration from consul.
2017-09-02 18:58:23.691 ERROR 5578 --- [ restartedMain] o.s.boot.SpringApplication : Application startup failed
com.ecwid.consul.v1.OperationException: OperationException(statusCode=500, statusMessage='Internal Server Error', statusContent='No cluster leader')
at com.ecwid.consul.v1.kv.KeyValueConsulClient.getKVValues(KeyValueConsulClient.java:159)
at com.ecwid.consul.v1.ConsulClient.getKVValues(ConsulClient.java:487)
at org.springframework.cloud.consul.config.ConsulPropertySource.init(ConsulPropertySource.java:66)
at org.springframework.cloud.consul.config.ConsulPropertySourceLocator.create(ConsulPropertySourceLocator.java:157)
at org.springframework.cloud.consul.config.ConsulPropertySourceLocator.locate(ConsulPropertySourceLocator.java:131)
at org.springframework.cloud.consul.config.ConsulPropertySourceLocator$$FastClassBySpringCGLIB$$b35ebf8.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.retry.interceptor.RetryOperationsInterceptor$1.doWithRetry(RetryOperationsInterceptor.java:91)
at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:286)
at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:163)
at org.springframework.retry.interceptor.RetryOperationsInterceptor.invoke(RetryOperationsInterceptor.java:118)
at org.springframework.retry.annotation.AnnotationAwareRetryOperationsInterceptor.invoke(AnnotationAwareRetryOperationsInterceptor.java:152)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673)
at org.springframework.cloud.consul.config.ConsulPropertySourceLocator$$EnhancerBySpringCGLIB$$66375879.locate(<generated>)
at org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize(PropertySourceBootstrapConfiguration.java:93)
at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:567)
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:338)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:301)
at com.pyg.auth.AuthServiceApp.main(AuthServiceApp.java:71)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
SpringBoot Main Class is annotated fine (I guess), because my spring-boot service was working fine with another consul instance earlier.
I was able to solve my issue by moving consul server and port configuration from application.yml to bootstrap.yml.
I don't know much about how it was solved and why it was unable to read from application.yml. If anyone has some details about it, pl. let me know.
Use sudo docker run -p 8500:8500 consul:0.9.2 -bootstrap to resolve the problem. I have
added -bootstrap one argument to bootstrap the server/servers and get elected as a leader. Manual bootstrapping with -bootstrap is not recommended in newer versions of Consul (0.5 and newer) as it is more error-prone.
Explanation:-
As said in docs Before a Consul cluster can begin to service requests, a server node must be elected leader. And this is reason of your exception on start of spring-boot service the leader has not been elected yet!!
Why the leader has not been elected? The list of servers involved in the cluster should be bootstrapped. And the servers can be bootstrapped using the
-bootstrap-expect configuration option. Recommended
Note:- Just for testing/learning purpose you can go ahead and create a single server because A single server deployment is highly discouraged as data loss is inevitable in a failure scenario.
Check your pom.xml.
Don't use spring-cloud-starter-consul-all. Use spring-cloud-starter-consul-discovery instead.
That worked for me.
Please check pom.xml to avoid using spring-cloud-starter-consul-all
If you use spring-cloud-starter-consul-all, please write the configuration to bootstrap.yml, the bootstrap.yml configuration file is the first to load.

Resources