Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
120 views
in Technique[技术] by (71.8m points)

java - spring-boot default log location

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 does it go?

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

/tmp/
/var/log/
~/

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

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)
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

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.

From the Spring Boot logging documentation.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...