springboot日志配置

  1. 直接通过yml配置文件配置
logging:
  file:
    name: logs/log.log
  level:
    com.yf: info
  charset:
    console: UTF-8
    file: UTF-8
  pattern:
    console : "%d{yyyy/MM/dd-HH:mm:ss} [%thread] [%X{taskId}] %-5level %logger===> %msg%n"
    file : "%d{yyyy/MM/dd-HH:mm:ss} [%thread] [%X{taskId}] %-5level %logger===> %msg%n"
  logback:
    rollingpolicy:
      max-file-size: 10MB
      max-history: 365
      file-name-pattern: /logs/%d{yyyy-MM-dd_HH}.%i.log.zip

你可能感兴趣的:(spring,boot,java,后端)