spring-boot默认日志位置 [英] spring-boot default log location

查看:586
本文介绍了spring-boot默认日志位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

spring-boot 应用程序中,我可以使用

In a spring-boot application I can specify a custom log file with

java -jar spring-boot-app.jar --logging.file = / home / ubuntu / spring-boot-app.log

但如果我没有指定一个,他们去哪里了?

But if I don't specify one, where do they go?

我在以下任何文件夹中都找不到它:

I couldn't find it in any of the following folders:

/tmp/
/var/log/
~/

I 具有 spring-boot-starter-logging 或任何额外的日志依赖项。

I do not have spring-boot-starter-logging or any extra log dependencies.

我希望有类似 catalina.out 的东西,因为默认配置运行嵌入式Tomcat:

I was hoping to have something similar to catalina.out since the default configuration runs an embedded Tomcat:

INFO 10374 --- [main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8100 (http)


推荐答案

Spring Boot使用Commons Logging进行所有内部日志记录,但保留底层日志实现。

Spring Boot uses Commons Logging for all internal logging, but leaves the underlying log implementation open.

为Java Util Logging,Log4J,Log4J2和Logback提供了默认配置。在每种情况下,记录器预先配置为使用控制台输出,并且可选的文件输出也可用。

Default configurations are provided for Java Util Logging, Log4J, Log4J2 and Logback. In each case loggers are pre-configured to use console output with optional file output also available.

来自 Spring Boot日志文档

默认日志配置会在写入时将消息回显给控制台。
因此,除非您按照描述明确指定文件,否则它将保留在控制台中。

The default log configuration will echo messages to the console as they are written. So until you explicitly specify a file as you described, it stays in the Console.

这篇关于spring-boot默认日志位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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