portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r413036 - in /portals/jetspeed-2/trunk: components/portal/src/java/org/apache/jetspeed/velocity/JetspeedVelocityViewServlet.java src/webapp/WEB-INF/velocity.properties
Date Fri, 09 Jun 2006 12:53:50 GMT
Author: ate
Date: Fri Jun  9 05:53:50 2006
New Revision: 413036

URL: http://svn.apache.org/viewvc?rev=413036&view=rev
Log:
Adding Commons Logging support for Velocity, JS2-543
See: http://issues.apache.org/jira/browse/JS2-543

Modified:
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/velocity/JetspeedVelocityViewServlet.java
    portals/jetspeed-2/trunk/src/webapp/WEB-INF/velocity.properties

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/velocity/JetspeedVelocityViewServlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/velocity/JetspeedVelocityViewServlet.java?rev=413036&r1=413035&r2=413036&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/velocity/JetspeedVelocityViewServlet.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/velocity/JetspeedVelocityViewServlet.java
Fri Jun  9 05:53:50 2006
@@ -16,7 +16,6 @@
 package org.apache.jetspeed.velocity;
 
 import java.io.File;
-import java.io.IOException;
 import java.util.Locale;
 import java.util.Map;
 
@@ -58,8 +57,6 @@
 import org.apache.velocity.context.Context;
 import org.apache.velocity.exception.ParseErrorException;
 import org.apache.velocity.exception.ResourceNotFoundException;
-import org.apache.velocity.runtime.RuntimeServices;
-import org.apache.velocity.runtime.log.LogSystem;
 
 /**
  * @version $Id$
@@ -321,71 +318,6 @@
 
         // no velocity engine available
         throw new Exception("No velocity engine available for request context.");
-    }
-
-    /** velocity engine logging adapter */
-    private static class VelocityEngineLogger implements LogSystem
-    {
-        /** velocity log */
-        private static final Log velocityLog = LogFactory.getLog("velocity");
-
-        /**
-         * init
-         *
-         * @see org.apache.velocity.runtime.log.LogSystem.init(org.apache.velocity.runtime.RuntimeServices)
-         */
-        public void init(RuntimeServices rsvc)
-        {
-        }
-        
-        /**
-         * logVelocityMessage
-         *
-         * @see org.apache.velocity.runtime.log.LogSystem.logVelocityMessage(int, java.lang.String)
-         */
-        public void logVelocityMessage(int level, String message)
-        {
-            switch (level)
-            {
-                case LogSystem.DEBUG_ID :
-                    velocityLog.debug(message);
-                    break;
-                case LogSystem.INFO_ID :
-                    velocityLog.info(message);
-                    break;
-                case LogSystem.WARN_ID :
-                    velocityLog.warn(message);
-                    break;
-                case LogSystem.ERROR_ID :
-                    velocityLog.error(message);
-                    break;
-                default :
-                    velocityLog.trace(message);
-                    break;
-            }
-        }
-    }
-
-    /**
-     * Loads Velocity configuration information and returns that 
-     * information as an ExtendedProperties, which will be used to 
-     * initialize the Velocity runtime.
-     *
-     * @see org.apache.velocity.tools.view.servlet.VelocityViewServlet.loadConfiguration()
-     *
-     * @param config ServletConfig passed to the servlets init() function.
-     * @return ExtendedProperties loaded with Velocity runtime configuration values.
-     * @throws IOException I/O problem accessing the specified file, if specified.
-     */
-    protected ExtendedProperties loadConfiguration(ServletConfig config)
-        throws IOException
-    {
-        // configure Velocity engines for using logging adapter
-        ExtendedProperties configuration = super.loadConfiguration(config);
-        configuration.clearProperty(VelocityEngine.RUNTIME_LOG_LOGSYSTEM_CLASS);
-        configuration.clearProperty("runtime.log.logsystem.log4j.category");
-        configuration.setProperty(VelocityEngine.RUNTIME_LOG_LOGSYSTEM, new VelocityEngineLogger());
-        return configuration;
     }
 
     /**

Modified: portals/jetspeed-2/trunk/src/webapp/WEB-INF/velocity.properties
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/WEB-INF/velocity.properties?rev=413036&r1=413035&r2=413036&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/WEB-INF/velocity.properties (original)
+++ portals/jetspeed-2/trunk/src/webapp/WEB-INF/velocity.properties Fri Jun  9 05:53:50 2006
@@ -27,6 +27,11 @@
 
 runtime.log = velocity.log
 
+# use Commons Logging for routing Velocity message through our IsolatedLog4JLogger
+runtime.log.logsystem.class =org.apache.jetspeed.webapp.logging.velocity.CommonsLoggingLog4JLogSystem
+# Log4J Category used (default is "velocity")
+runtime.log.logsystem.log4j.category = velocity
+
 #----------------------------------------------------------------------------
 # T E M P L A T E  E N C O D I N G
 #----------------------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message