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.

Get Mastering Spring Boot 2.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.