Code example for LogRecord

Methods: setLevel

0
				+ "$MockFormatter"); 
		LogManager.getLogManager().readConfiguration(
				EnvironmentHelper.PropertiesToInputStream(p));
		ConsoleHandler h = new ConsoleHandler();
 
		LogRecord r = new LogRecord(Level.INFO, "testPublish_NoFilter");
		h.setLevel(Level.INFO);
		h.publish(r);
		h.flush();
		assertEquals("MockFormatter_Head" + "testPublish_NoFilter",
				this.errSubstituteStream.toString());
 
		h.setLevel(Level.WARNING);
		h.publish(r);
		h.flush();
		assertEquals("MockFormatter_Head" + "testPublish_NoFilter",
				this.errSubstituteStream.toString());
 
		h.setLevel(Level.CONFIG);
		h.publish(r);
		h.flush();
		assertEquals("MockFormatter_Head" + "testPublish_NoFilter"
				+ "testPublish_NoFilter", this.errSubstituteStream.toString());
 
		r.setLevel(Level.OFF);
		h.setLevel(Level.OFF);
		h.publish(r);
		h.flush();
		assertEquals("MockFormatter_Head" + "testPublish_NoFilter"
				+ "testPublish_NoFilter", this.errSubstituteStream.toString());
Stop searching for code, let great code find you!  Add Codota to your java IDE