OnJava8-Examples/logging/MultipleHandlers.java

16 lines
501 B
Java
Raw Normal View History

2015-05-05 11:20:13 -07:00
//: logging/MultipleHandlers.java
// {Clean: MultipleHandlers.xml,MultipleHandlers.xml.lck}
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");
}
} ///:~