System.setProperty(Log.class.getName(), SimpleLog.class.getName());
LogFactory.releaseAll();
System.setErr(stream);
final Logger logger = new CommonsLogger(LogFactory.getLog("JUnit"), "JUnit");
final Logger child = logger.getChildLogger("test");
child.fatalError("foo");
assertEquals("[FATAL] JUnit.test - foo", buffer.toString().trim());
}
finally
{
System.setProperties(systemProperties);