1.pom.xml
<dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.4</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.5</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> <version>1.7.5</version> </dependency>
2.
import lombok.extern.slf4j.Slf4j; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @Slf4j public class Test { final static Logger logger = LoggerFactory.getLogger(Test.class ); public static void main(String []args) { System.out.println(log.isInfoEnabled()); log .info("你好啊{}","01"); logger.error("cc"); } }