application specific logging with log4j on weblogic 8.1

Hi,

For a few days now, I have been trying to implement application specific logging using Log4j (1.2.x) for my 3 applications running on the same server (8.1.6). All three application war files are generated from same source. I followed the example of Jboss in setting up the Hierarchy for logging using RepositorySelector. In my case Java class which implements RepositorySelector is loaded through ServletContextListener from jar file placed in WEB_INF/lib folder and log4j.properties file is in WEB-INF folder of each application.

Independent logging of each application takes place correctly, if the applications are deployed from console.However logging fails if weblogic is shutdown and restarted, in this case logging takes place from 2 classes only implementing filters of each application. Logging from other classes is not taking place. I am spinning my wheels on this and can't seem to figure out what the issue is.

Thanks for any help...below is the snippet of code

Sohan

public static synchronized void init(ServletContext config, String strLogProperties, String webAppName)

throws ServletException {

if( !initialized ) // set the global RepositorySelector

{

defaultRepository = LogManager.getLoggerRepository();

RepositorySelector theSelector = new MyRepositorySelector();

LogManager.setRepositorySelector(theSelector, guard);

initialized = true;

}

Hierarchy hierarchy = new Hierarchy(new RootCategory(Level.DEBUG));

loadLog4JConfig(config, hierarchy, strLogProperties, webAppName);

ClassLoader loader = Thread.currentThread().getContextClassLoader();

repositories.put(loader, hierarchy);

config.setAttribute("hierarchy", hierarchy );

}

public LoggerRepository getLoggerRepository() {

ClassLoader loader = Thread.currentThread().getContextClassLoader();

LoggerRepository repository = (LoggerRepository)repositories.get(loader);

if (repository == null) {

return defaultRepository;

} else {

return repository;

}

}

public void LogInit(ServletContext ctx) throws ServletException {

System.out.println("\n\nLog4jInit\n\n");

String strLogProperties = ctx.getInitParameter("Log4JProperties");

System.out.println("Log4j properties " + strLogProperties);

String webAppName = ctx.getInitParameter("LogFileName");

System.out.println("App log File name " + webAppName);

if (webAppName == null ) {

webAppName = getWebAppName(ctx);

}

System.out.println("Application name = " + webAppName);

MyRepositorySelector.init(ctx, strLogProperties, webAppName);

LOG = Logger.getLogger(this.getClass());

LOG.info("Log message from Log4jInit ServletContextListener");

System.out.println("\n\nLog4jInit: Complete\n\n");

}

[2888 byte] By [NewJavaBeea] at [2007-11-15]