import java.util.logging.Logger;
public class LoggingExample {
private static final Logger logger = Logger.getLogger(LoggingExample.class.getName());
public static void main(String[] args) {
logger.info("This is an information message.");
logger.warning("This is a warning message.");
logger.severe("This is a severe message.");
}
}
properties
handlers=java.util.logging.ConsoleHandler, java.util.logging.FileHandler
java.util.logging.ConsoleHandler.level=ALL
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
java.util.logging.FileHandler.level=ALL
java.util.logging.FileHandler.pattern=logs/myapp.log
java.util.logging.FileHandler.formatter=java.util.logging.XMLFormatter