Code example for LogRecord

Methods: getLevel, getLoggerName, getMessage, getParameters, getResourceBundleName, getSourceClassName, getSourceMethodName, getThrown

0
	/* 
	 * Test log(LogRecord) for a normal log record. Meanwhile the logger has an 
	 * appropriate level, no filter, no parent. 
	 */ 
	public void testLog_LogRecord_AppropriateLevelNoFilterNoParent() { 
		LogRecord r = new LogRecord(Level.INFO,
				"testLog_LogRecord_AppropriateLevelNoFilterNoParent"); 
 
		this.sharedLogger.setLevel(Level.INFO);
		this.sharedLogger.log(r);
 
		assertSame(r, CallVerificationStack.getInstance().pop());
		assertTrue(CallVerificationStack.getInstance().empty());
		assertSame(r.getLoggerName(), null);
		assertEquals(r.getMessage(),
				"testLog_LogRecord_AppropriateLevelNoFilterNoParent"); 
		assertSame(r.getResourceBundleName(), null);
		assertSame(r.getSourceClassName(), null);
		assertSame(r.getSourceMethodName(), null);
		assertSame(r.getLevel(), Level.INFO);
		assertNull(r.getParameters());
		assertSame(r.getThrown(), null);
	} 
 
	/* 
	 * Test log(LogRecord) with null log record. 
	 */