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.
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.
It is possible to use slf4j-simple and make it write to the standard output by setting a system property when the program starts:
More information at http://www.slf4j.org/api/org/slf4j/impl/SimpleLogger.html
This might help: sysout-over-slf4j
Put simplelogger.properties in your classpath and put this line in it:
This will cause SLF4J Simple Logger to log to Standard Output instead of Standard Error.
Consider slf4j-simple, but it logs to stderr instead of stdout. It's the bare-minimum implementation. Source code browsable here: http://grepcode.com/file/repo1.maven.org/maven2/org.slf4j/slf4j-simple/1.6.1/org/slf4j/impl/SimpleLogger.java?av=f
SLF4J is a logging facade. You need a logging implementation.
Nowadays, Logback is the recommanded logging framework.
To log to System.out, you have to use the ConsoleAppender in Logback configuration file.
Example :