Reputation: 81
i'm developing a application using spring boot version 1.3.5 (spring 4.2.6). i use log4j2 version 2.4.1 as logging system. when working on sts (spring tool suite) and executing on embeeded tomcat, the logs works fine (on console and on file) but when building a war file and deploying it on external tomcat 8 the log file is created but my logs don't appear in it.
i've looked for similar issue and tested some solutions:
but none of this solution work. the post that talks about that is: Spring-Boot Logging configuration when deployed as .war
any help or detailled answer please.
Upvotes: 8
Views: 2453
Reputation: 4558
If you want to configure log4j for your Spring Boot application inside Tomcat, this documentation may help you :
https://tomcat.apache.org/tomcat-8.5-doc/logging.html#Using_Log4j
Using Log4j
This section explains how to configure Tomcat to use log4j rather than
java.util.logging
for all Tomcat's internal logging.Note: The steps described in this section are needed when you want to reconfigure Tomcat to use Apache log4j for its own logging. These steps are not needed if you just want to use log4j in your own web application. — In that case, just put
log4j.jar
andlog4j.properties
intoWEB-INF/lib
andWEB-INF/classes
of your web application.The following steps describe configuring log4j to output Tomcat's internal logging.
Create a file called
log4j.properties
with the following content and save it into$CATALINA_BASE/lib
Upvotes: 1