在pom.xml加入依赖
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
Demo.java
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Demo{
private static final Logger logger = LoggerFactory.getLogger(Demo.class);
public void loggerDemo(Integer code) {
try {
("accept:=========命令为:{}", code);
} catch (Exception var2) {
logger.error("error:============0x:" + code);
var2.printStackTrace();
}
}
}