import java.util.logging.*; public class MyApplication { private static final Logger logger = Logger.getLogger(MyApplication.class.getName()); public static void main(String[] args) { LogManager.getLogManager().reset(); ConsoleHandler consoleHandler = new ConsoleHandler(); consoleHandler.setFormatter(new SimpleFormatter()); logger.addHandler(consoleHandler); logger.info("This is an info log message"); logger.warning("This is a warning log message"); logger.severe("This is a severe log message"); } }


上一篇:
下一篇:
切换中文