if (initialized) return;
initialized = true;
try {
ConfigContext ctx =
ConfigFactory.createConfigContext
(configFile, true, false, false,
com.sun.enterprise.config.clientbeans.ClientContainer.class,
new com.sun.enterprise.config.clientbeans.ClientBeansResolver());
final ClientContainer cc =
ClientBeansFactory.getClientBean(ctx);
String logLevel = cc.getLogService().getLevel();
if (logLevel != null && !logLevel.equals("")) {
_logLevel = Level.parse(logLevel);
}
String logFileName = cc.getLogService().getFile();
if (logFileName != null && !logFileName.equals("")) {
_clientHandler = new FileHandler(logFileName, true);
_clientHandler.setFormatter(new SimpleFormatter());
// workaround to delete lockfile upon exit
File lockFile = new File(logFileName + ".lck");
lockFile.deleteOnExit();
}
} catch (Exception ex) {
if (_logger != null) {
_logger.logrb(Level.SEVERE, null, null,
"com.sun.logging.enterprise.system.container.appclient.LogStrings",
"acc.cannot_create_log_handler", ex);
}
}
// Previously registered loggers need to be
// modified to use the right handler and set the
// the right level.
Enumeration e = getLoggerNames();
while (e.hasMoreElements()) {
String loggerName = (String) e.nextElement();
Logger l = getLogger(loggerName);
initializeLogger(l);
}