简体   繁体   中英

Logback configuration for a Spring Boot web application

I am using Spring Boot to build a simple webapp, however, I am not using the embedded Tomcat container. Instead, I am building a .war file and deploying manually to a Tomcat 7 instance.

I am using Logback with the following configuration:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property name="LOG_FILE" value="./logs/jcme.log" />
<include resource="org/springframework/boot/logging/logback/base.xml" />

    <!-- 3rd Party Loggers -->
    <logger name="org.springframework.web" level="INFO" />
    <logger name="org.springframework.boot" level="INFO" />
    <logger name="org.hibernate" level="INFO" />
    <logger name="org.quartz" level="INFO" />
</configuration>

When running the .war file inside Tomcat running in Eclipse, the log appends properly to both STDOUT and FILE appenders as configured in "../logback/base.xml".

However, when deploying this to an external Tomcat container, the "jcme.log" file is created, but is empty.

What am I missing?

Please have a look on this . I had the same issue and created a setenv.bat file in my /bin with following code and it worked:

    set logging.config=classpath:/logback.xml

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