默认的格式

%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}

增加行号

%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%thread]){faint} %clr(%-40.40logger{39}){cyan} %L %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}

注意,添加了%L

配置

 
logging:
  pattern:
    console: "%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%thread]){faint} %clr(%-40.40logger{39}){cyan} %L %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"
  level:
    com.netflix.discovery: 'INFO'
    org.springframework.cloud: 'WARN'    

相关文章:

  • 2021-11-19
  • 2022-12-23
  • 2021-05-18
  • 2022-12-23
  • 2021-04-19
  • 2021-05-24
  • 2021-11-06
  • 2021-11-14
猜你喜欢
  • 2022-01-20
  • 2021-12-31
  • 2022-01-19
  • 2021-10-18
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案