好学的滨滨
2018-07-27 21:05
表示从头到尾都跟老师打的一样呀,求大神解答呀!
maven的porm.xml需要以下几个依赖
<!-- sl4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.10</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.1.2</version>
</dependency>
logback.xml文件放到指定的文件夹目录下src/main/resources
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type ch.qos.logback.classic.encoder.PatternLayoutEncoder
by default -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<root level="debug">
<appender-ref ref="STDOUT" />
</root>
</configuration>
测试类当中像老师那样调用即可
private final Logger logger = LoggerFactory.getLogger(this.getClass());
logger.info("s={}", s);
Java高并发秒杀API之Service层
59897 学习 · 137 问题
相似问题
回答 1