我开始使用slf4j以及节俭。我设法做的是打印单行日志,如下所示:
[main] INFO FinanceServiceHandler - BEGIN getUserOutcomes
[main] INFO FinanceServiceHandler - found 690 records
[main] INFO FinanceServiceHandler - returned 690 results
[main] INFO FinanceServiceHandler - END getUserOutcomes
对应代码:
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
this.logger = LoggerFactory.getLogger("FinanceServiceHandler");
logger.info("BEGIN getUserOutcomes");
logger.info("found {} records", outcomes.size());
logger.info("returned {} results", result.size());
logger.info("END getUserOutcomes");
我正在尝试找到打印双线日志的方法,就像描述here( 6.控制台输出)一样:
slf4j multiline logs http://cdn.srccodes.com/c/072012/5/3.png
此外,当我启动应用程序时,Hibernate以类似的双行日志开始:
mar 28, 2013 3:12:01 PM org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
mar 28, 2013 3:12:01 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.1.10.Final}
mar 28, 2013 3:12:01 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
mar 28, 2013 3:12:01 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
mar 28, 2013 3:12:01 PM org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
mar 28, 2013 3:12:01 PM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
mar 28, 2013 3:12:02 PM org.hibernate.cfg.Configuration doConfigure
INFO: HHH000041: Configured SessionFactory: null
如何使用日期时间信息使slf4j打印双行?