首页  

slf4j 使用     所属分类 slf4j 浏览量 147
logback 1.2.11 
slf4j-api-1.7.36.jar

import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class LogTest { private static final Logger log = LoggerFactory.getLogger(LogTest.class); public static void main(String[] args) { log.info("hello"); log.info("hello","java"); log.info("hello,{}","java"); log.info("hello,{},{}","java"); log.error("hello,{},{}","java",new Exception("error1")); log.error("hello,{},{}","java","java8",new Exception("error2")); log.error("hello,{},{}","java","java8","java21",new Exception("error3")); // error4 被忽略 log.error("hello,{},{}","java",new Exception("error4"),new Exception("error5")); } }
15:13:58.874 [main] INFO demo.test.LogTest - hello 15:13:58.877 [main] INFO demo.test.LogTest - hello 15:13:58.879 [main] INFO demo.test.LogTest - hello,java 15:13:58.879 [main] INFO demo.test.LogTest - hello,java,{} 15:13:58.880 [main] ERROR demo.test.LogTest - hello,java,{} java.lang.Exception: error1 at demo.test.LogTest.main(LogTest.java:17) 15:13:58.880 [main] ERROR demo.test.LogTest - hello,java,java8 java.lang.Exception: error2 at demo.test.LogTest.main(LogTest.java:18) 15:13:58.880 [main] ERROR demo.test.LogTest - hello,java,java8 java.lang.Exception: error3 at demo.test.LogTest.main(LogTest.java:19) 15:13:58.881 [main] ERROR demo.test.LogTest - hello,java,{} java.lang.Exception: error5 at demo.test.LogTest.main(LogTest.java:21) Process finished with exit code 0

上一篇     下一篇
小学奥数数论基础

小学数学各年级学习重点难点和方法

小学数学公式大全

feign UnknownHostException

2024网盘排行榜

小学奥数术语