private LoggerStore createHierarchy( final int index )
throws Exception
{
final Configuration logs = loadConfig( "config" + index + ".xml" );
final LogManager logManager = createLogManager();
final SarMetaData sarMetaData =
new SarMetaData( "test",
m_baseDirectory,
new BlockMetaData[0],
new BlockListenerMetaData[0] );
cleanHomeDirectory( sarMetaData );
//make sure directory is created else log4j will fail.
if( 3 == index )
{
final File file =
new File( m_baseDirectory.getAbsolutePath() +
File.separator +
"logs" );
file.mkdirs();
}
final HashMap context = new HashMap();
context.put( BlockContext.APP_NAME, sarMetaData.getName() );
context.put( BlockContext.APP_HOME_DIR,
sarMetaData.getHomeDirectory() );
context.put( "classloader", getClass().getClassLoader() );
final LoggerStore store =
logManager.createHierarchy( logs,
sarMetaData.getHomeDirectory(),
sarMetaData.getHomeDirectory(),
context );
return store;
}