Spring 启动日志记录路径 [英] Spring boot logging path

查看:55
本文介绍了Spring 启动日志记录路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在 spring boot application.properties 中配置了日志路径属性.

I have configured the logging path property in my spring boot application.properties.

logging.path=
logging.file=

在 application.properties 中的相应属性中.它正在获取日志文件名并在 tomcat 日志文件目录中创建一个新的日志文件.我检查了我的系统属性,它设置了 LOG_FILE 和 LOG_PATH 属性.我使用的是 1.3.6 版本的 spring boot.与此相关的任何已知问题.我读过一期,似乎很久以前就修复了.

In respective of this property in application.properties. It is taking the logging file name and creating a new log file in tomcat log file directory.I checked my system properties it has set both LOG_FILE and LOG_PATH property. I have using 1.3.6 version of spring boot. Any known issue related to this. I have read one issue and it seems to be fixed long back.

推荐答案

你只能使用一个的两个属性,你可以设置:

You can only use one of the two properties, either you set:

  • 日志文件名(logging.file);
  • 路径(logging.path).
  • the logging file name (logging.file);
  • or the path (logging.path).

您不能同时指定两者.

来源

Spring 文档对此非常微妙:

Spring documentation is very subtle on this:

如果你想在控制台输出之外写入日志文件,你需要设置一个 logging.file OR logging.path 属性.

If you want to write log files in addition to the console output you need to set a logging.file OR logging.path property.

springframework.guru 是这样说的:

还有一个 logging.path 属性来指定日志记录的路径文件.如果使用它,Spring Boot 会在指定路径.但是,您不能同时指定 logging.file 和logging.path 属性放在一起.如果完成,Spring Boot 将忽略

There is also a logging.path property to specify a path for a logging file. If you use it, Spring Boot creates a spring.log file in the specified path. However, you cannot specify both the logging.file and logging.path properties together. If done, Spring Boot will ignore both.

这篇关于Spring 启动日志记录路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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