import java.util.logging.Level; import java.util.logging.Logger; public class MyClass { private static final Logger LOGGER = Logger.getLogger(MyClass.class.getName()); public static void main(String[] args) { LOGGER.info("Application started"); // Application code LOGGER.warning("Something unexpected happened"); // More application code LOGGER.info("Application finished"); } } # Set the default log level to INFO .level=INFO # Log Manager configuration for specific packages com.example.package.level=FINEST # Output log to console handlers=java.util.logging.ConsoleHandler # Specify console log format java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter


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