I've got a simple setup to log a message: Java 8 Update 65 and Eclipse Mars:
import java.util.logging.Logger;
public class Example {
private final static Logger LOGGER = Logger.getLogger(Example.class.getName());
public static void main(String[] args) {
LOGGER.info("Test");
}
}
I would expect to get an output on the stdout, just like using System.out.println();
, but instead it gets printed out on the stderr, which results in a red font on the eclipse console:
I know that I can change this behavior by writing a custom Handler
, but I wish to know why the default output appears on the stderr instead of stdout?
A logger should use stdout for fine
+info
and use stderr for severe
level.
By default, the logger outputs log records of level INFO and above (i.e., INFO, WARNING and SEVERE) to standard error stream (System.err).
Source: www3.ntu.edu.sg/home/ehchua/programming/java/JavaLogging.html