I use Spring Boot and want it to write log output to a file.
According to the docs, this is simply done by setting
logging.file=filename.log
<
Here is how i managed to write output to a local file file. To disable console logging and write output only to a file you need a custom logback-spring.xml ( call it logback-spring.xml so you ll take advantage of the templating features (date formatting etc..) provided by Boot) that imports file-appender.xml instead of console-appender.xml. In order to achieve this, you must paste this code below into your logback-spring.xml file.
You also need to add the following to your application.properties:
logging.file=myapplication.log
Notice that this log file myapplication.log will be generated by springboot.
This is how my application structure tree looks like:
If you want to have more fun, you can locate the base.xml in your maven dependencies like this: