Spring boot
- Embedded Tomcat does not start
- Embedded Tomcat access logs
Tomcat does not start and application exits with 0
Dealing with the spring boot application completing in Intellij IDE without starting tomcat
Main reason for the situation where Tomcat does not start is Java version mismatch.
- Make sure Java 21 and Java 17 are both present on the system
- create a springboot project, setting Java version to 21,code it and start
- The application starts and completes without starting the embedded Tomcat.
- When the war is deployed into a standalone Tomcat it works as expected
- Change Java version in the pom.xml to 17,set JAVA_HOME to your Java 17 installation, resync and start the application. The embedded server will start
Embedded Tomcat logging enabled in springboot
To enable the embedded tomcat logging add the following lines to application.properties file
spring.application.name=yourapp
server.tomcat.accesslog.enabled=true
server.tomcat.accesslog.suffix=.log
server.tomcat.accesslog.prefix=access_log
server.tomcat.accesslog.file-date-format=.yyyy-MM-dd
server.tomcat.basedir=tomcat
server.tomcat.accesslog.directory=logs
server.tomcat.accesslog.pattern=common
top of the page