简体   繁体   English

Spring Boot Web应用程序的登录配置

[英]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. 我正在使用Spring Boot构建一个简单的Web应用程序,但是,我没有使用嵌入式Tomcat容器。 Instead, I am building a .war file and deploying manually to a Tomcat 7 instance. 相反,我正在构建.war文件并手动部署到Tomcat 7实例。

I am using Logback with the following configuration: 我将Logback用于以下配置:

<?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". 在Eclipse中运行的Tomcat中运行.war文件时,该日志会按照“ ../logback/base.xml”中的配置正确地附加到STDOUT和FILE附加程序。

However, when deploying this to an external Tomcat container, the "jcme.log" file is created, but is empty. 但是,将其部署到外部Tomcat容器时,将创建“ jcme.log”文件,但该文件为空。

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: 我遇到了同样的问题,并使用以下代码在/ bin中创建了一个setenv.bat文件,它可以正常工作:

    set logging.config=classpath:/logback.xml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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