Skip to content
OptiJava edited this page May 25, 2022 · 10 revisions

一、占位符

在初始化日志之后,调用:
log.info("Your score is #1 , but full mark is #2", "100", "100000");
输出:
......Your score is 100 , but full mark is 100000
#1代表占位符中的第一个,可以在日志中重复使用

二、输出异常
调用方法:
log.error("Test Exception", new Throwable("Test", new Exception()));
输出:
java.lang.Throwable : Test
at com.optilog.test main(test.java:8) <-这前面有四个空格
Caused By: java.lang.Exception
at com.optilog.test main(test.java:8) <-这前面有四个空格

Clone this wiki locally