spring-boot使用-日志信息

# logBack配置
logging:
  path: logs
  level:
    com.fh: ERROR
    com.fh.mapper: DEBUG
  file: ${logging.path}/openplatform.log
  pattern:
    #file: "%5level %d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } [%thread] --- [%t] %-40.40logger{39} : %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"
    #console: "%5level %d{yyyy-MM-dd HH:mm:ss.SSS}: [%thread] %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"
    file: "%-5level %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %X{req.remoteHost} %X{req.requestURI} %X{username} %logger - %msg%n"
    console: "%-5level %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %X{req.remoteHost} %X{req.requestURI} %X{username} %logger - %msg%n"
Spring-boot日志打印:
                          日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,如果设置成WARN的话,低于WAIN的都不会输出
在application.properties中添加 debug=true的话,核心Logger会输出更多,更详细的内容,但是自己应用的日志不会输出成DEbug
 
  • %d{HH: mm:ss.SSS}——日志输出时间
  • %thread——输出日志的进程名字,这在Web应用以及异步任务处理中很有用
  • %-5level——日志级别,并且使用5个字符靠左对齐
  • %logger{36}——日志输出者的名字
  • %msg——日志消息
  • %n——平台的换行符

猜你喜欢

转载自www.cnblogs.com/nihaofenghao/p/8965921.html