Logging to stdout
Logging to stdout with Log4J
Lo4J can also be used to log experimental data. Because log4J supports several Levels of priority, you can separate experimental data from server output by using different log levels. Experimental data you could for instance represent as
logger.info("experimental data");
while you would represent server output as
logger.debug("some debugging statement");
In the Log4J configuration you can then specify what Appender to use for each priority.
Logging to stdout with println's
Of course, simple System.out.println("some string") statements will also log to stdout. However, as these println's don't support levels of priority, the use of Log4J is preferred over these println statements.