I have a spring boot application that uses hibernate with oracle and hibernate envers. The application takes a long time to starup. from the logs, I can see something like this
2020-06-05 09:51:40,727 [main] INFO org.hibernate.dialect.Dialect - HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect
2020-06-05 09:52:20,219 [main] INFO org.hibernate.envers.boot.internal.EnversServiceImpl - Envers integration enabled? : true
2020-06-05 09:53:02,809 [main] INFO org.hibernate.engine.transaction.jta.platform.internal.JtaPlatformInitiator - HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
if we see the timestamp between log statements the difference is pretty large.
can anyone suggest how I can improve the startup time?
Related
Our SpringBoot tests use Hikari datasource obtained via JNDI.
So from test to test the embedded server is started/shutdown.
Since HikariPool start printed in the log, but none of shutdown, does it mean that our tests are causing connection leak ?
Found these:
INFO HikariDataSource - HikariPool - Starting...
INFO HikariDataSource - HikariPool - Start completed.
But none of these:
INFO HikariDataSource - HikariPool - Shutdown initiated...
INFO HikariDataSource - HikariPool - Shutdown completed.
Should I worry about it?
Any advice would be greatly appreciated.
Best regards,
SetNug
I am trying to disable connecting to kafka using spring boot with simple flag and could not find any working examples. I tried auto-start flags provides in the spring boot and kafka api documentations, but none of them worked.
The reason is I do not want to connect in local, or dev environments - so how can I disable this? I want to use flags and not use #Profile annotations
2022-10-05 INFO o.s.c.s.binder.DefaultBinderFactory : Creating binder: kafka
2022-10-05 INFO o.s.c.s.binder.DefaultBinderFactory : Caching the binder: kafka
2022-10-05 INFO o.s.c.s.binder.DefaultBinderFactory : Retrieving cached binder: kafka
2022-10-05 INFO o.s.c.s.b.k.p.KafkaTopicProvisioner : Using kafka topic for outbound: abc.def.ghi
2022-10-05 INFO o.a.k.clients.admin.AdminClientConfig : AdminClientConfig values:
bootstrap.servers = [my.confluent.cloud:1234]
client.dns.lookup = use_all_dns_ips
client.id =
and a lot of admin client config values
I want to disable creating binders
I've been seeing weird square brackets and can't find and info on what there might be,
logs looking like that:
--2022-08-23 08:47:44.882 INFO [,,,] 30446 --- [)-192.168.0.165] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
--2022-08-23 08:47:44.882 INFO [,,,] 30446 --- [)-192.168.0.165] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
--2022-08-23 08:47:44.922 INFO [,,,] 30446 --- [)-192.168.0.165] o.s.web.servlet.DispatcherServlet : Completed initialization in 40 ms
as you can see there are brackets with commas after log level, at some point info in the brackets change like this:
DEBUG [,080578da-b973-450b-9cae-2c5900ab56fe,080578da-b973-450b-9cae-2c5900ab56fe,]
can't really find what that could be, i'am using default spring boot logging pattern,
could it be wrongfully used MDC without redeclaring the logging pattern?
if it is MDC problem then why any value in the brackets look like this: 080578da-b973-450b-9cae-2c5900ab56fe
The logger I'm using is Slf4j
This could happen if you use Spring Cloud Sleuth. Spring Cloud Sleuth is a framework that adds the following to your logs:
The application name (from the spring.application.name property)
A trace ID (a unique ID for each user-initiated request)
A span ID (a unique ID for a unit of work)
These IDs can be used to correlate log messages in a distributed system (eg. microservices), because these IDs will be passed from microservice to microservice. In the documentation you can find an example of what this looks like.
In your case, you're not using these properties, which is why they're empty. The trace ID is automatically generated upon each request, which is why you sometimes see [,,] and [,XXX,].
If you're not interested in these trace/span IDs, you can remove the spring-cloud-sleuth or spring-cloud-starter-sleuth library.
I have setup my spring boot project as mentioned in this link . I expected it to provide endpoints such as health, metrics etc. Instead it only gives me the following three endpoints. What do I do to get all the endpoints?
Spring boot version : 2.0.0.M5
INFO 2017-10-14 01:45:31,176 [main][] org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping - Mapped "{[/application/status],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.String>)
INFO 2017-10-14 01:45:31,176 [main][] org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping - Mapped "{[/application/info],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.String>)
INFO 2017-10-14 01:45:31,177 [main][] org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping - Mapped "{[/application],methods=[GET]}" onto private java.util.Map<java.lang.String, java.util.Map<java.lang.String, org.springframework.boot.actuate.endpoint.web.Link>> org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping.links(javax.servlet.http.HttpServletRequest)
The endpoint /actuator/metrics was valid only after I added the line management.endpoints.web.exposure.include=* to file application.properties.
I am using spring-boot-actuator:2.0.0.RELEASE.
To enable all endpoints by default, you can add the following property:
For application.properties:
endpoints.default.enabled=true
For application.yml:
endpoints:
default:
enabled: true
Also you can check out other properties for spring boot 2.0.0.M5 here
After I upgrade my spring boot to 2.0.0.M5 apparently only /status and /info actuator endpoints are enabled by default.
To enable e.g. /metrics:
endpoints:
metrics:
enabled: true
The new version to enable endpoints:
management.endpoints.web.expose=*
I am using http://cloud.spring.io/spring-cloud-sleuth/spring-cloud-sleuth.html#_adding_to_the_project for adding Spring Cloud Sleuth without the Zipkin integration
But in one of the microserives out of three, does not show the spanid, and token id in logs after adding dependency for all services (all are http request services, though there are couple of more services which require JMS - on which I need to work)
Service1
2016-06-05 17:12:45.404 INFO [my-service1-id,73b62c0f90d11e06,73b62c0f90d11e06,false] 85184 --- [nio-8080-exec-1] com.example.MyService1MakingARequest
Service2
2016-06-05 17:12:45.404 INFO 85185 --- [nio-8080-exec-1] com.example.MyService2MakingARequest
Service3
2016-06-05 17:12:45.404 INFO [my-service3-id,73b62c0f90d11e06,73b62c0f90d11e06,false] 85185 --- [nio-8080-exec-1] com.example.MyService3MakingARequest
Experts, Please suggest what can be done to see the effect in Service2
The best thing to do would be to show your sample project. Another is to check if you don't have a custom logback.xml or any other type of logging configuration that breaks the current set up (most likely you do cause I can see that the pattern is different).