java.util.logging.FileHandler Handler

		Logger log = Logger.getLogger("com.my.test.lg");
		log.setLevel(Level.FINER);
		log.setUseParentHandlers(true);//true:会同时发送到控制台
		//Handler handler = new FileHandler();
		Handler handler = new FileHandler(Thread.class.getResource("/").getPath()+"java%u.log");//此处配置的pattern会覆盖logging.properties里java.util.logging.FileHandler.pattern的配置
		handler.setLevel(Level.INFO);
		log.addHandler(handler);
		
		log.severe(" severe");
		log.warning(" warning");
		log.info(" info");
		log.config(" config");
		log.fine(" fine");
		log.finer(" finer");
		log.finest(" finest");

你可能感兴趣的:(学习笔记,Java)