如何为System.out制作记录器 [英] How to make a Logger for System.out
本文介绍了如何为System.out制作记录器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何为System.out获取org.slf4j.Logger.我知道这不好,但是出于测试目的,我需要它.
I am wondering how to get org.slf4j.Logger for System.out. I know this is not good, but I need it for testing purposes.
非常感谢您.
推荐答案
可以在程序启动时通过设置系统属性来使用slf4j-simple并将其写入标准输出:
It is possible to use slf4j-simple and make it write to the standard output by setting a system property when the program starts:
System.setProperty("org.slf4j.simpleLogger.logFile", "System.out");
更多信息,请参见 http://www.slf4j.org/api /org/slf4j/impl/SimpleLogger.html
这篇关于如何为System.out制作记录器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文