Reputation: 3695
Console log is by default activated in spring boot. I like to log to file, e.g. /var/log/mylog.log.
How to enable file logging in spring boot?
Upvotes: 2
Views: 4773
Reputation: 3695
According to Spring Boot documentation you have to enable file logging by setting a property in your application configuration (application.properties / application.yaml / etc.).
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.properties).
For example in application.properties:
logging.file=myFile
Writes to the specified log file. Names can be an exact location or relative to the current directory.
logging.path=/var/log
Writes spring.log to the specified directory. Names can be an exact location or relative to the current directory.
Upvotes: 2