1.private final Logger logger = LoggerFactory.getLogger(当前类.class);
logger.debug("debug");
logger.info("info");
logger.error("error");
2.或者使用注解 @Slf4j
然后下面使用
log.debug("debug");
log.info("info");
log.error("error");
3. 输出参数
String name = "asd";
String password = "asds";
log.info("name: {}, password: {} ", name, password)
4.日志logback的配置
①application.yml
②logbac-spring.xml
原文地址:https://www.cnblogs.com/SkyeAngel/p/9211380.html
时间: 2024-11-05 22:44:21