我已经开始使用 slf4j 和 thrift。我设法做的是打印单行日志,就像这样:
[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");
我正在尝试找到打印双行日志的方法,就像这里描述的那样(6.控制台输出):
(来源:srccodes.com)
此外,当我启动我的应用程序时,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 打印带有日期时间信息的双行?