final Hierarchy defaultHierarchy = Hierarchy.getDefaultHierarchy();
final ErrorHandler errorHandler = new DefaultErrorHandler();
defaultHierarchy.setErrorHandler(errorHandler);
defaultHierarchy.setDefaultLogTarget(servTarget);
defaultHierarchy.setDefaultPriority(logPriority);
final Logger logger = new LogKitLogger(Hierarchy.getDefaultHierarchy().getLoggerFor(""));
final String loggerManagerClass =
this.getInitParameter("logger-class", LogKitLoggerManager.class.getName());
// the log4j support requires currently that the log4j system is already configured elsewhere
final LoggerManager loggerManager =
newLoggerManager(loggerManagerClass, defaultHierarchy);
ContainerUtil.enableLogging(loggerManager, logger);
final DefaultContext subcontext = new DefaultContext(this.appContext);
subcontext.put("servlet-context", this.servletContext);
subcontext.put("context-work", this.workDir);
if (this.servletContextPath == null) {
File logSCDir = new File(this.workDir, "log");
logSCDir.mkdirs();
if (logger.isWarnEnabled()) {
logger.warn("Setting context-root for LogKit to " + logSCDir);
}
subcontext.put("context-root", logSCDir.toString());
} else {
subcontext.put("context-root", this.servletContextPath);
}