yml配置

#logging
logging.file: "logs/app.log"
logging:
  level:
    root: debug
  file:
    max-size: 10MB
    max-history: 20
  pattern:
    console: "%d %-5level %-40.40logger{39} [lineNo:%-4line] : %msg%n"
    file: "%d %-5level [%thread] %-40.40logger{39} [lineNo:%-4line] : %msg%n"

使用

private final Logger logger = LoggerFactory.getLogger(this.getClass());
public void test(){
    logger.error("The username or password isn't correct.");
}
posted on 2019-11-08 13:49  liehen2046  阅读(145)  评论(0编辑  收藏  举报