import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;
public class LoggerDemo {
public static void main(String[] args) {
Logger logger = Logger.getLogger(LoggerDemo.class.getName());
Logger global = Logger.getLogger(logger.GLOBAL_LOGGER_NAME);
logger.setLevel(Level.FINE);
for(Handler handler : logger.getParent().getHandlers()){
handler.setLevel(Level.FINE);
}
logger.log(Level.WARNING , "WARING信息!!!");
logger.log(Level.INFO, "INFO信息");
logger.log(Level.CONFIG, "config信息");
logger.log(Level.FINE, "FINE 信息");
System.out.println("=====================");
System.out.println(logger.getLevel());
System.out.println(logger.getParent().getLevel());
System.out.println(global.getParent().getLevel());
}
}
import java.util.logging.Level;
import java.util.logging.Logger;
public class LoggerDemo {
public static void main(String[] args) {
Logger logger = Logger.getLogger(LoggerDemo.class.getName());
Logger global = Logger.getLogger(logger.GLOBAL_LOGGER_NAME);
logger.setLevel(Level.FINE);
for(Handler handler : logger.getParent().getHandlers()){
handler.setLevel(Level.FINE);
}
logger.log(Level.WARNING , "WARING信息!!!");
logger.log(Level.INFO, "INFO信息");
logger.log(Level.CONFIG, "config信息");
logger.log(Level.FINE, "FINE 信息");
System.out.println("=====================");
System.out.println(logger.getLevel());
System.out.println(logger.getParent().getLevel());
System.out.println(global.getParent().getLevel());
}
}