Default log file for spring boot application

I set the logging level in the spring boot application in application.yml as: logging.level.com.Myapplicationname = DEBUGGING

The application is packaged and deployed like a war with tomcat. Other than that, I did not set logback.xml to define a log file, etc. Please tell me where I can see console logs when a user uses the application through a browser. Is there a default file created by the wireframe.

+7
spring-boot logging
source share
2 answers

You can specify logging.file or logging.path , but not both.

1. Using logging.file

You need to add the following property:

 logging.file = yourlogfile.log 

In the Spring Boot Documentation :

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

In Spring Download the document registration method :

If the only change you need to make for logging is to set the levels of different loggers, then you can do this in application.properties using the prefix "logging.level", for example. You can also specify the location of the login file (in addition to the console) using "logging.file".

2. Using logging.path

You can also set logging.path , then the log file will be called spring.log :

 logging.path = /path/to/logs 

In Spring Boot Document :

[Using logging.path] Writes spring.log to the specified directory. Names may be the exact location or relative to the current directory.

springframework.guru on Spring Log Download :

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

+9
source share

As alexbt said, you cannot use both properties at the same time (logging.path and logging.file), because Spring Boot ignores both.

But you can use logging.file with path encoding.

Example: logging.file = / path / to / logs / your_logfile.log

+4
source share

All Articles