Spring Boot Not Creating Log File (Spring Boot 2.3.7)

Viewed 11

I am trying to configure Spring Boot with yaml file. I have created the configuration as:

debug: true
logging:
  charset:
    console: UTF-8
    file: UTF-8
  file:
    name: spring-boot-logs.log
    path: ${user.home}/logs/
  level:
    root: trace
    web: trace
  pattern:
    file: "%red(%date) %blue(%logger) [%highlight(%-5level)] [%yellow(%method)] [%green(%thread)]%cyan(: %msg%n%throwable)"
  register-shutdown-hook: true
server:
  port: 8080
spring:
  main:
    banner-mode: "log"

But when I start the application, I don't see any file with the name spring-boot-logs.log created under my Home directory. My objective is to redirect Spring's console logs to a file.

Am I making a mistake in the way I am declaring the path or do I have to provide an absolute path instead of the one with ${user.home}.

Also for logback I wanted to know what is the difference between register-shutdown-hook being set to true and on? Its on a different line, don't want to start a different question about it.

0 Answers
Related