Mastering Spring Boot 2.0
上QQ阅读APP看书,第一时间看更新

Logging output

Spring Boot logs, by default, to the console, but you can also log to rotating files. You can specify a file or path in application.properties. Let's see the following configuration:

# Use only one of the following properties 
 
# absolute or relative file to the current directory 
logging.file=accounts.log 
 
# will write to a spring.log file 
logging.path=/var/log/accounts 

Spring Boot can also configure logging by using the appropriate configuration file of the underlying logging framework.

As you have seen how we can customize the logging activity in a Spring Boot application, let's move to the next section and see an alternative to the properties file.