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.");
}