How to make a Logger for System.out

Anton K. picture Anton K. · Dec 22, 2011 · Viewed 19.3k times · Source

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.

Thank you so much.

Answer

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");

More information at http://www.slf4j.org/api/org/slf4j/impl/SimpleLogger.html