* change root logger name to the shorter form of "webui".

* initialized CLogMgt for the webui root logger if the platform have been started by other server side services.
This commit is contained in:
Heng Sin Low 2010-07-20 01:01:46 +08:00
parent 912afccfe0
commit 0452d2128d
2 changed files with 19 additions and 12 deletions

View File

@ -81,7 +81,7 @@ public class SessionContextListener implements ExecutionInit,
SessionManager.getAppDesktop().showURL(url, true);
}
});
ctx.put(CLogMgt.ROOT_LOGGER_NAME_PROPERTY, "org.adempiere.webui");
ctx.put(CLogMgt.ROOT_LOGGER_NAME_PROPERTY, WebUIServlet.WEBUI_ROOT_LOGGER_NAME);
ctx.setProperty(SERVLET_SESSION_ID, httpSession.getId());
session.setAttribute(SESSION_CTX, ctx);
}

View File

@ -49,16 +49,13 @@ import org.adempiere.util.ServerContextURLHandler;
*/
public class WebUIServlet extends DHtmlLayoutServlet
{
private static final long serialVersionUID = 1L;
public static final String WEBUI_ROOT_LOGGER_NAME = "webui";
private static final long serialVersionUID = 1L;
/** Logger for the class * */
private static CLogger logger;
static
{
logger = CLogger.getCLogger(WebUIServlet.class);
}
public void init(ServletConfig servletConfig) throws ServletException
{
super.init(servletConfig);
@ -70,20 +67,30 @@ public class WebUIServlet extends DHtmlLayoutServlet
SessionManager.getAppDesktop().showURL(url, true);
}
});
serverContext.put(CLogMgt.ROOT_LOGGER_NAME_PROPERTY, "org.adempiere.webui");
serverContext.put(CLogMgt.ROOT_LOGGER_NAME_PROPERTY, WEBUI_ROOT_LOGGER_NAME);
ServerContext.setCurrentInstance(serverContext);
boolean started = Adempiere.startup(false);
if(!started)
if (!Adempiere.isStarted())
{
throw new ServletException("Could not start ADempiere");
boolean started = Adempiere.startup(false);
if(!started)
{
throw new ServletException("Could not start ADempiere");
}
}
else
{
CLogMgt.initialize(false);
CLogMgt.setLevel(Ini.getProperty(Ini.P_TRACELEVEL));
}
logger = CLogger.getCLogger(WebUIServlet.class);
// hengsin: temporary solution for problem with zk client
Ini.setProperty(Ini.P_ADEMPIERESYS, false);
ReportCtl.setReportViewerProvider(new ZkReportViewerProvider());
ReportStarter.setReportViewerProvider(new ZkJRViewerProvider());
logger.log(Level.OFF, "ADempiere started successfully");
logger.log(Level.OFF, "ADempiere web ui service started successfully");
/**
* End ADempiere Start
*/