使用log4.properties文件的Spring Boot日志无法正常工作 [英] Spring boot logging with log4.properties file in not working

查看:33
本文介绍了使用log4.properties文件的Spring Boot日志无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在resources文件夹下有log4j.properties文件.现在,我在application.properties文件中传递logging.file =/Users/jkuriakos/web/rnt/dr/rnt.log.如何使用log4j.properties文件从log4j.properties文件加载所有信息(如smtp服务器等)?

I have log4j.properties file under resources folder. Now I am passing logging.file=/Users/jkuriakos/web/rnt/dr/rnt.log in application.properties file. How can I use the log4j.properties file to load all information (like smtp server etc) from log4j.properties file?

推荐答案

从您的 pom 文件中排除 spring-boot-starter-logging 并添加以下依赖项:

Exclude the spring-boot-starter-logging from your pom file and add following dependency:

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-log4j</artifactId>
    </dependency>

这应该使Spring Boot从resources文件夹中获取log4j.properties. http://docs.spring.io/spring-boot/docs/current/reference/html/howto-logging.html#howto-configure-log4j-for-logging

This should make spring boot pick up log4j.properties from resources folder. http://docs.spring.io/spring-boot/docs/current/reference/html/howto-logging.html#howto-configure-log4j-for-logging

这篇关于使用log4.properties文件的Spring Boot日志无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆