标签:ati get parse level 特性 style 消息 final eve
1 import java.util.logging.Level; 2 import java.util.logging.Logger; 3 4 public class LoggingDemo { 5 public static final Logger logger = Logger.getLogger("LoggingDemo.class"); 6 7 public static void main(String args[]) { 8 Level level = Level.parse("FINEST"); 9 logger.info(level.toString()); 10 11 //下面的消息将被输出 12 logger.setLevel(level); 13 logger.info("this is an info"); 14 logger.warning("this is a warn"); 15 logger.severe("this is a severe"); 16 // logger.config("config"); 17 // logger.fine("fine"); 18 // logger.finer("finer"); 19 // logger.finest("finest"); 20 21 logger.info("LoggerName: " + logger.getName()); 22 logger.info("LoggerLevelName: " + logger.getLevel().getName()); 23 24 } 25 }
运行结果:
五月 23, 2018 5:13:24 下午 org.study2.java8.logging.LoggingDemo main 信息: FINEST 五月 23, 2018 5:13:24 下午 org.study2.java8.logging.LoggingDemo main 信息: this is an info 五月 23, 2018 5:13:24 下午 org.study2.java8.logging.LoggingDemo main 警告: this is a warn 五月 23, 2018 5:13:24 下午 org.study2.java8.logging.LoggingDemo main 严重: this is a severe 五月 23, 2018 5:13:24 下午 org.study2.java8.logging.LoggingDemo main 信息: LoggerName: LoggingDemo.class 五月 23, 2018 5:13:24 下午 org.study2.java8.logging.LoggingDemo main 信息: LoggerLevelName: FINEST
标签:ati get parse level 特性 style 消息 final eve
原文地址:https://www.cnblogs.com/gongxr/p/9077925.html