简体   繁体   中英

Tomcat server logs not showing in spring boot application

I have a spring boot application where I have configured a listener consuming messages in a queue. I also have a controller which is used for healthcheck purposes. When the service starts, I get the following logs. But I don't see any logs on the Tomcat server atarting and the port it is running on.

2022-07-15 15:39:24.628  INFO [bo-bse-permissible-users-job,,,] 226627 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate Core {5.3.7.Final}
2022-07-15 15:39:24.630  INFO [bo-bse-permissible-users-job,,,] 226627 --- [           main] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
2022-07-15 15:39:24.789  INFO [bo-bse-permissible-users-job,,,] 226627 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.0.4.Final}
2022-07-15 15:39:24.940  INFO [bo-bse-permissible-users-job,,,] 226627 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
2022-07-15 15:39:25.888  INFO [bo-bse-permissible-users-job,,,] 226627 --- [           main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2022-07-15 15:39:26.911  INFO [bo-bse-permissible-users-job,,,] 226627 --- [           main] o.h.h.i.QueryTranslatorFactoryInitiator  : HHH000397: Using ASTQueryTranslatorFactory
2022-07-15 15:39:28.112  INFO [bo-bse-permissible-users-job,,,] 226627 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'threadPoolTaskExecutorForPlatformStatus'
2022-07-15 15:39:33.946  INFO [bo-bse-permissible-users-job,,,] 226627 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService
2022-07-15 15:39:34.182  INFO [bo-bse-permissible-users-job,,,] 226627 --- [           main] c.p.e.bo.BoBsePermissibleApplication     : Started BoBsePermissibleApplication in 16.853 seconds (JVM running for 17.168)

I have another similar service and following are the logs shown

2022-07-15 15:43:57.812  INFO 227112 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8000 (http)
2022-07-15 15:43:57.813  INFO 227112 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2022-07-15 15:43:57.813  INFO 227112 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.16]
2022-07-15 15:43:57.819  INFO 227112 --- [           main] o.a.c.c.C.[Tomcat-1].[localhost].[/]     : Initializing Spring embedded WebApplicationContext
2022-07-15 15:43:57.819  INFO 227112 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 77 ms
2022-07-15 15:43:57.843  INFO 227112 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 26 endpoint(s) beneath base path '/actuator'
2022-07-15 15:43:57.912  INFO 227112 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8000 (http) with context path ''
2022-07-15 15:43:57.932  INFO 227112 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 5555 (http) with context path ''
2022-07-15 15:43:57.933  INFO 227112 --- [           main] c.p.b.e.BoConsumerExchangeAckApplication : Started BoConsumerExchangeAckApplication in 13.602 seconds (JVM running for 13.873)

I can see the tomcat server logs in the other application even though all the dependencies are pretty much the same.

I can also see the tomcat jars present in the external libraries: tomcat-embed-core-9.0.16.jar , tomcat-embed-el-9.0.16.jar , tomcat-embed-websocket-9.0.16.jar .

The service is consuming the message and processing it but I'm struggling to deploy it on a server.

Edit:

Found the issue, one line in the application.properties file was causing this.

spring.main.web-application-type=none

Removed this and I was able to see the port in which tomcat has started and was able to hit my controller correctly.

Try this!

Define the following in application.yml or application.properties

logging:
 level:
   org.apache:
    DEBUG

Alternatively, before starting your application, you can also check Enable debug output in your Run configurations !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM