Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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) 
like image 868
cahen Avatar asked Aug 11 '15 10:08

cahen


People also ask

Where are spring boot logs stored?

By default, Spring Boot logs only to the console and does not write log files. If you want to write log files in addition to the console output, you need to set a logging. file or logging. path property (for example, in your application.

How are spring boot logs stored?

To make Spring Boot write its log to disk, set the path and filename. With this configuration, Spring Boot will write to the console and also to a log file called spring. log , at the path you specify.

What is default logging in spring boot?

The default logging configuration in Spring Boot is a Logback implementation at the info level for logging the output to console. Let us see this behavior in action by creating a Spring Boot application. We generate a minimal application with just the web dependency using start.spring.io.

Does spring boot use Logback by default?

By default, Spring Boot picks up the native configuration from its default location for the system (such as classpath:logback. xml for Logback), but you can set the location of the config file by using the "logging. config" property.


1 Answers

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.

like image 183
Laurentiu L. Avatar answered Oct 05 '22 07:10

Laurentiu L.