OnJava8-Examples/logging/LogToFile.java

17 lines
422 B
Java
Raw Normal View History

2015-05-05 11:20:13 -07:00
//: logging/LogToFile.java
import java.util.logging.*;
public class LogToFile {
private static Logger logger =
Logger.getLogger("LogToFile");
2015-05-18 23:05:20 -07:00
public static void
main(String[] args) throws Exception {
logger.addHandler(
new FileHandler("LogToFile.xml"));
2015-05-05 11:20:13 -07:00
logger.info("A message logged to the file");
}
2015-05-18 23:05:20 -07:00
} /* Output:
May 14, 2015 3:29:53 PM LogToFile main
INFO: A message logged to the file
*///:~