OnJava8-Examples/logging/MultipleHandlers.java
2015-05-29 14:18:51 -07:00

23 lines
671 B
Java

//: logging/MultipleHandlers.java
// ©2015 MindView LLC: see Copyright.txt
import java.util.logging.*;
public class MultipleHandlers {
private static Logger logger =
Logger.getLogger("MultipleHandlers");
public static void
main(String[] args) throws Exception {
FileHandler logFile =
new FileHandler("MultipleHandlers.xml");
logger.addHandler(logFile);
logger.addHandler(new ConsoleHandler());
logger.warning(
"Output to multiple handlers");
}
} /* Output:
May 14, 2015 3:29:53 PM MultipleHandlers main
WARNING: Output to multiple handlers
May 14, 2015 3:29:53 PM MultipleHandlers main
WARNING: Output to multiple handlers
*///:~