Code example for ConsoleHandler

Methods: closepublishflush

0
		Properties p = new Properties();
		p.put("java.util.logging.ConsoleHandler.formatter", className
				+ "$MockFormatter"); 
		LogManager.getLogManager().readConfiguration(
				EnvironmentHelper.PropertiesToInputStream(p));
		ConsoleHandler h = new ConsoleHandler();
 
		h.publish(new LogRecord(Level.SEVERE,
				"testClose_SufficientPrivilege_Exception msg")); 
		h.flush();
		h.close();
	} 
 
	/* 
	 * Test close() when having sufficient privilege, and no record has been 
	 * written to the output stream. 
	 */ 
	public void testClose_SufficientPrivilege_DirectClose() throws Exception { 
		Properties p = new Properties();
		p.put("java.util.logging.ConsoleHandler.formatter", className
Contextual code suggestions in your IDE  Get Codota for Java