@Test
public void testLogException() {

	final StringHandler logHandler = new StringHandler();
	// Prepare a logger
	Logger logger = Logger.getLogger( getClass().getName());
	LogManager.getLogManager().addLogger( logger );
	logger.setLevel( Level.FINEST );
	logger.addHandler( logHandler );
	// Run the first test
	Assert.assertEquals( "", logHandler.getLogs());
	Utils.logException( logger, new Exception( "boo!" ));
	Assert.assertTrue( logHandler.getLogs().startsWith( "java.lang.Exception: boo!" ));
	// Change the log level
	logger.setLevel( Level.INFO );
	Assert.assertFalse( logger.isLoggable( Level.FINEST ));
	Assert.assertTrue( logger.isLoggable( Level.INFO ));
	logHandler.getStringBuilder().setLength( 0 );
	Assert.assertEquals( "", logHandler.getLogs());
	Utils.logException( logger, new Exception( "boo!" ));
	Assert.assertEquals( "", logHandler.getLogs());
	Utils.logException( logger, Level.INFO, new Exception( "boo!" ));
	Assert.assertTrue( logHandler.getLogs().startsWith( "java.lang.Exception: boo!" ));
	// With an additional message
	logHandler.getStringBuilder().setLength( 0 );
	Assert.assertEquals( "", logHandler.getLogs());
	Utils.logException( logger, Level.INFO, new Exception( "nice try!" ), "again" );
	Assert.assertTrue( logHandler.getLogs().startsWith( "again\njava.lang.Exception: nice try!" ));
}