I have configured Spring Boot to work with tomcat as in the guide: https://www.baeldung.com/spring-boot-war-tomcat-deploy . When I run the application from my IDE I can see everything on the console, but on tomcat the logs don't show anything, I also configured this:
logging.level.org.springframework.web=DEBUG
logging.level.org.hibernate=ERROR
and no luck any idea ?
my application.properites
# ===============================
# = DATA SOURCE
# ===============================
spring.datasource.url = jdbc:mysql://...
spring.datasource.username = root
spring.datasource.password = admin
# ===============================
# = JPA / HIBERNATE
# ===============================
spring.jpa.show-sql = true
spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
# ==============================================================
# = Spring Security / Queries for AuthenticationManagerBuilder
# ==============================================================
spring.queries.users-query=select email, password, active from user where email=?
spring.queries.roles-query=select u.email, r.role from user u inner join user_role ur on(u.id=ur.user_id) inner join role r on(ur.role_id=r.id) where u.email=?
logging.level.org.springframework.web=DEBUG
logging.level.org.hibernate=ERROR
I encountered same problem, so I thought my answer will be helpful if someone has same case.
When we created the springboot app, we forgot to extend SpringBootServletInitializer in our main class. Without this, servlet context binding between your app and tomcat container does not happen. That is why, though the war is exploded, app is not actually deployed, hence no application logs. find more details here https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/web/servlet/support/SpringBootServletInitializer.html
@EnableSwagger2
@SpringBootApplication
@EnableJpaRepositories("com.scn.scheduler.dal")
@EnableScheduling
public class SCNSchedulerApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(SCNSchedulerApplication.class, args);
}
}
Add the following in your Spring Boot's application.properties
logging.file=../logs/mylog.log
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With