Spring Boot - no log file written (logging.file is not respected)
In my case, I used below, in the application property file.
logging.file
Instead, I need to use the below one:
logging.file.name
Since then, I could be able to get the logs into the directed path file.
I found a solution. I am not very happy with it since it still does not answer my original question why the logging.file
property is not respected.
I created the logback-spring.xml
from Georges' answer in the same directory where application.properties
resides. According to the documentation Spring Boot will pick it up from there. Apparently, this does not happen in my case.
I need to additionally add logging.config=classpath:logback-spring.xml
in order it is picked up by Spring. The relevant parts of my application.properties
are now
logging.config=classpath:logback-spring.xml
logging.file=logs/logfile.log
(I created the logs
directory manually.)
Use logging.file.name
instead of logging.file
In higher versions of spring-boot-parent(from version 2.2.0)
, property logging.file is deprecated.