Here is the logback-spring.xml used in my project and it works well with external Tomcat.
<configuration> <include resource="org/springframework/boot/logging/logback/defaults.xml"/> <include resource="org/springframework/boot/logging/logback/file-appender.xml" /> <root level="INFO"> <appender-ref ref="FILE"/> </root> </configuration>
And in application.yml file:
logging.file: "/var/logs/tomcat/application.log"
===== Edited:
I would also use springProfile in the logback configuration to separate configurations for starting locally from starting in production; this way I can get the logs in the IDE console during development:
<configuration> <include resource="org/springframework/boot/logging/logback/defaults.xml"/> <springProfile name="local"> <include resource="org/springframework/boot/logging/logback/console-appender.xml" /> <include resource="org/springframework/boot/logging/logback/file-appender.xml" /> <root level="INFO"> <appender-ref ref="CONSOLE"/> <appender-ref ref="FILE"/> </root> </springProfile> <springProfile name="prod"> <include resource="org/springframework/boot/logging/logback/file-appender.xml" /> <root level="INFO"> <appender-ref ref="FILE"/> </root> </springProfile> </configuration>
source share