SpringBoot Logger

关于如何配置 SpringBoot 中的 Logger,以及如何使用,配置内容在 AOP 部分

logger 日志

1
2
3
4
5
6
7
8
9
# application.yml
logging:
pattern:
# console: "%d{HH:mm:ss} [%t] %-5level %logger{36} - %msg%n"
file: "%d{HH:mm:ss} [%t] %-5level %logger{36} - %msg%n"
level:
root: INFO
file:
name: logs/blog.log
1
2
3
4
5
6
7
    private static final Logger logger = LoggerFactory.getLogger(LoggerAspect.class);  //定义logger

logger.error("This is an error message");
logger.warn("This is a warning message");
logger.info("This is an info message");
logger.debug("This is a debug message");
logger.trace("This is a trace message");