java 如何在 spring-boot 应用程序中每天滚动日志文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/44152855/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 07:59:22  来源:igfitidea点击:

How to roll log file daily in spring-boot application

javaspring-bootlogback

提问by John

I deployed a spring-boot application on CentOS 6.5.
The application is started by command 'service app start'.
Below is content of app.conf.

我在 CentOS 6.5 上部署了一个 spring-boot 应用程序。
该应用程序由命令“service app start”启动。
下面是 app.conf 的内容。

JAVA_HOME=/xxx
LOG_FOLDER=/xxx

I am confused that how to roll log file daily.
There is no logback.xml or any other logback configuration in application.properties.

我很困惑如何每天滚动日志文件。
application.properties 中没有 logback.xml 或任何其他 logback 配置。

回答by Niranjan Kumar

You can place new logback.xmland write your appenders accordingly and place it in classpath, the application.propertieswill automatically look for it.

您可以放置​​ newlogback.xml并相应地编写您的 appender 并将其放置在类路径中,application.properties它将自动查找它。

For more info please refer doc
For appenders it is already answered here

有关更多信息,请参阅doc
For appenders 已在此处回答