From: bruce m. <tr...@us...> - 2004-07-24 00:19:04
|
Update of /cvsroot/babeldoc/babeldoc/modules/web/src/com/babeldoc/web/main In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26389/modules/web/src/com/babeldoc/web/main Modified Files: ConsoleServlet.java Log Message: Logging cleanups... 1. Created log instance variable instead of calling LogService.getInstance(). 2. All logs to debug check if debug level is set. Index: ConsoleServlet.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/web/src/com/babeldoc/web/main/ConsoleServlet.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ConsoleServlet.java 27 Jun 2003 02:09:21 -0000 1.8 --- ConsoleServlet.java 24 Jul 2004 00:18:54 -0000 1.9 *************** *** 66,70 **** --- 66,72 ---- package com.babeldoc.web.main; + import com.babeldoc.core.EnvironmentLoader; import com.babeldoc.core.I18n; + import com.babeldoc.core.LogService; import com.babeldoc.core.user.*; *************** *** 129,132 **** --- 131,135 ---- static final String PARM_PASSWORD = "password"; + private LogService log = LogService.getInstance(this.getClass().getName()); /** * main routine to handle a request. Called by VelocityServlet, your *************** *** 160,165 **** outty = getTemplate(path); } catch (ParseErrorException pee) { ! com.babeldoc.core.LogService.getInstance().logError(I18n.get("web.005"), ! pee); try { --- 163,167 ---- outty = getTemplate(path); } catch (ParseErrorException pee) { ! log.logError(I18n.get("web.005"), pee); try { *************** *** 168,173 **** } } catch (ResourceNotFoundException rnfe) { ! com.babeldoc.core.LogService.getInstance().logError(com.babeldoc.core.I18n.get( ! "web.006"), rnfe); try { --- 170,174 ---- } } catch (ResourceNotFoundException rnfe) { ! log.logError(I18n.get("web.006"), rnfe); try { *************** *** 176,181 **** } } catch (Exception e) { ! com.babeldoc.core.LogService.getInstance().logError(com.babeldoc.core.I18n.get( ! "000001"), e); } --- 177,181 ---- } } catch (Exception e) { ! log.logError(I18n.get("000001"), e); } *************** *** 197,212 **** HttpSession session = request.getSession(true); String path = request.getServletPath(); ! System.out.println("Context path: " + request.getContextPath()); ! System.out.println("Servet path: " + path); UserResource resource = UserResourceFactory.getInstance().getUserResource(path); IUserContext userContext = (IUserContext) session.getAttribute(USER_CONTEXT); ! com.babeldoc.core.LogService.getInstance().logDebug(com.babeldoc.core.I18n.get( ! "web.002") + userContext); if ((userContext == null) && UserResourceFactory.getInstance().mustAuthenticate(resource)) { ! com.babeldoc.core.LogService.getInstance().logDebug(com.babeldoc.core.I18n.get( ! "web.003")); // If we are in process of logging in. --- 197,215 ---- HttpSession session = request.getSession(true); String path = request.getServletPath(); ! ! if(log.isDebugEnabled()) { ! log.logDebug("Context path: " + request.getContextPath()); ! log.logDebug("Servet path: " + path); ! } UserResource resource = UserResourceFactory.getInstance().getUserResource(path); IUserContext userContext = (IUserContext) session.getAttribute(USER_CONTEXT); ! if(log.isDebugEnabled()) ! log.logDebug(I18n.get("web.002") + userContext); if ((userContext == null) && UserResourceFactory.getInstance().mustAuthenticate(resource)) { ! if(log.isDebugEnabled()) ! log.logDebug(I18n.get("web.003")); // If we are in process of logging in. *************** *** 220,229 **** if (UserFactory.getInstance().authenticate(userContext, new PasswordUserCredential(password))) { ! com.babeldoc.core.LogService.getInstance().logDebug(com.babeldoc.core.I18n.get( ! "web.004")); request.getSession().setAttribute(USER_CONTEXT, userContext); ! com.babeldoc.core.LogService.getInstance().logDebug(com.babeldoc.core.I18n.get( ! "web.004")); path = (String) request.getSession().getAttribute(LOGON_BOUNCE); } else { --- 223,234 ---- if (UserFactory.getInstance().authenticate(userContext, new PasswordUserCredential(password))) { ! ! if(log.isDebugEnabled()) ! log.logDebug(I18n.get("web.004")); request.getSession().setAttribute(USER_CONTEXT, userContext); ! ! if(log.isDebugEnabled()) ! log.logDebug(I18n.get("web.004")); path = (String) request.getSession().getAttribute(LOGON_BOUNCE); } else { *************** *** 237,242 **** } else { session.setAttribute(LOGON_BOUNCE, path); ! com.babeldoc.core.LogService.getInstance().logDebug("LOGON_BOUNCE: " + ! path); path = LOGON_PAGE; } --- 242,247 ---- } else { session.setAttribute(LOGON_BOUNCE, path); ! if(log.isDebugEnabled()) ! log.logDebug("LOGON_BOUNCE: " + path); path = LOGON_PAGE; } *************** *** 271,275 **** p.setProperty("runtime.log", path + "velocity.log"); ! com.babeldoc.core.EnvironmentLoader.loadEnvironment(); System.out.println(p.toString()); --- 276,280 ---- p.setProperty("runtime.log", path + "velocity.log"); ! EnvironmentLoader.loadEnvironment(); System.out.println(p.toString()); |