You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by nb...@apache.org on 2007/04/02 21:27:30 UTC
svn commit: r524893 - in /velocity/engine/trunk: build/build.properties
build/download.xml pom.xml
src/java/org/apache/velocity/runtime/defaults/velocity.properties
src/java/org/apache/velocity/runtime/log/CommonsLogLogChute.java
Author: nbubna
Date: Mon Apr 2 12:27:29 2007
New Revision: 524893
URL: http://svn.apache.org/viewvc?view=rev&rev=524893
Log:
add CommonsLogLogChute and make it 4th LogChute option in the default properties
Added:
velocity/engine/trunk/src/java/org/apache/velocity/runtime/log/CommonsLogLogChute.java (with props)
Modified:
velocity/engine/trunk/build/build.properties
velocity/engine/trunk/build/download.xml
velocity/engine/trunk/pom.xml
velocity/engine/trunk/src/java/org/apache/velocity/runtime/defaults/velocity.properties
Modified: velocity/engine/trunk/build/build.properties
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/build/build.properties?view=diff&rev=524893&r1=524892&r2=524893
==============================================================================
--- velocity/engine/trunk/build/build.properties (original)
+++ velocity/engine/trunk/build/build.properties Mon Apr 2 12:27:29 2007
@@ -31,7 +31,7 @@
deprecation= off
# Needs to be configured with system location of javacc for parser task
-javacc.home= *unset*
+javacc.home= C:/java/java.net/javacc
velocity.build.dir= build
@@ -113,6 +113,7 @@
jar.avalon-logkit.version= 2.1
jar.commons-collections.version= 3.1
jar.commons-lang.version= 2.1
+jar.commons-logging.version= 1.1
jar.jdom.version= 1.0
jar.log4j.version= 1.2.12
jar.oro.version= 2.0.8
Modified: velocity/engine/trunk/build/download.xml
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/build/download.xml?view=diff&rev=524893&r1=524892&r2=524893
==============================================================================
--- velocity/engine/trunk/build/download.xml (original)
+++ velocity/engine/trunk/build/download.xml Mon Apr 2 12:27:29 2007
@@ -34,6 +34,7 @@
<antcall target="avalon-logkit-download" />
<antcall target="commons-collections-download" />
<antcall target="commons-lang-download" />
+ <antcall target="commons-logging-download" />
<antcall target="jdom-download" />
<antcall target="log4j-download" />
<antcall target="oro-download" />
@@ -110,6 +111,12 @@
<target name="commons-lang-download">
<property name="download.jarname" value="${jar.commons-lang.name}" />
<property name="download.jarversion" value="${jar.commons-lang.version}" />
+ <antcall target="http-download"/>
+ </target>
+
+ <target name="commons-logging-download">
+ <property name="download.jarname" value="commons-logging" />
+ <property name="download.jarversion" value="${jar.commons-logging.version}" />
<antcall target="http-download"/>
</target>
Modified: velocity/engine/trunk/pom.xml
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/pom.xml?view=diff&rev=524893&r1=524892&r2=524893
==============================================================================
--- velocity/engine/trunk/pom.xml (original)
+++ velocity/engine/trunk/pom.xml Mon Apr 2 12:27:29 2007
@@ -171,6 +171,12 @@
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.12</version>
Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/defaults/velocity.properties
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/defaults/velocity.properties?view=diff&rev=524893&r1=524892&r2=524893
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/defaults/velocity.properties (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/defaults/velocity.properties Mon Apr 2 12:27:29 2007
@@ -23,7 +23,7 @@
# default LogChute to use: default: AvalonLogChute, Log4JLogChute, JdkLogChute
# ----------------------------------------------------------------------------
-runtime.log.logsystem.class = org.apache.velocity.runtime.log.AvalonLogChute,org.apache.velocity.runtime.log.Log4JLogChute,org.apache.velocity.runtime.log.JdkLogChute
+runtime.log.logsystem.class = org.apache.velocity.runtime.log.AvalonLogChute,org.apache.velocity.runtime.log.Log4JLogChute,org.apache.velocity.runtime.log.JdkLogChute,org.apache.velocity.runtime.log.CommonsLogLogChute
# ---------------------------------------------------------------------------
# This is the location of the Velocity Runtime log.
Added: velocity/engine/trunk/src/java/org/apache/velocity/runtime/log/CommonsLogLogChute.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/log/CommonsLogLogChute.java?view=auto&rev=524893
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/log/CommonsLogLogChute.java (added)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/log/CommonsLogLogChute.java Mon Apr 2 12:27:29 2007
@@ -0,0 +1,156 @@
+package org.apache.velocity.runtime.log;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.velocity.runtime.RuntimeServices;
+import org.apache.velocity.runtime.log.LogChute;
+
+/**
+ * Redirects Velocity's LogChute messages to commons-logging.
+ *
+ * <p>To use, first set up commons-logging, then tell Velocity to use
+ * this class for logging by adding the following to your velocity.properties:
+ *
+ * <code>
+ * runtime.log.logsystem.class = org.apache.velocity.runtime.log.CommonsLogLogChute
+ * </code>
+ * </p>
+ *
+ * <p>You may also set this property to specify what log/name Velocity's
+ * messages should be logged to (example below is default).
+ * <code>
+ * runtime.log.logsystem.commons.logging.name = org.apache.velocity
+ * </code>
+ * </p>
+ *
+ * @author Nathan Bubna
+ * @since Velocity 1.6
+ * @version $Id: CommonsLogLogChute.java 71982 2004-02-18 20:11:07Z nbubna $
+ */
+public class CommonsLogLogChute implements LogChute
+{
+
+ /** Property key for specifying the name for the log instance */
+ public static final String LOGCHUTE_COMMONS_LOG_NAME =
+ "runtime.log.logsystem.commons.logging.name";
+
+ /** Default name for the commons-logging instance */
+ public static final String DEFAULT_LOG_NAME = "org.apache.velocity";
+
+
+ /** the commons-logging Log instance */
+ protected Log log;
+
+
+ /********** LogChute methods *************/
+
+ public void init(RuntimeServices rs) throws Exception
+ {
+ String name =
+ (String)rs.getProperty(LOGCHUTE_COMMONS_LOG_NAME);
+
+ if (name == null)
+ {
+ name = DEFAULT_LOG_NAME;
+ }
+ log = LogFactory.getLog(name);
+ log(LogChute.DEBUG_ID, "CommonsLogLogChute name is '" + name + "'");
+ }
+
+ /**
+ * Send a log message from Velocity.
+ */
+ public void log(int level, String message)
+ {
+ switch (level)
+ {
+ case LogChute.WARN_ID:
+ log.warn(message);
+ break;
+ case LogChute.INFO_ID:
+ log.info(message);
+ break;
+ case LogChute.DEBUG_ID:
+ log.debug(message);
+ break;
+ case LogChute.TRACE_ID:
+ log.trace(message);
+ break;
+ case LogChute.ERROR_ID:
+ log.error(message);
+ break;
+ default:
+ log.debug(message);
+ break;
+ }
+ }
+
+ /**
+ * Send a log message from Velocity with an error.
+ */
+ public void log(int level, String message, Throwable t)
+ {
+ switch (level)
+ {
+ case LogChute.WARN_ID:
+ log.warn(message, t);
+ break;
+ case LogChute.INFO_ID:
+ log.info(message, t);
+ break;
+ case LogChute.DEBUG_ID:
+ log.debug(message, t);
+ break;
+ case LogChute.TRACE_ID:
+ log.trace(message, t);
+ break;
+ case LogChute.ERROR_ID:
+ log.error(message, t);
+ break;
+ default:
+ log.debug(message, t);
+ break;
+ }
+ }
+
+ /**
+ * Checks whether the specified log level is enabled.
+ */
+ public boolean isLevelEnabled(int level)
+ {
+ switch (level)
+ {
+ case LogChute.DEBUG_ID:
+ return log.isDebugEnabled();
+ case LogChute.INFO_ID:
+ return log.isInfoEnabled();
+ case LogChute.TRACE_ID:
+ return log.isTraceEnabled();
+ case LogChute.WARN_ID:
+ return log.isWarnEnabled();
+ case LogChute.ERROR_ID:
+ return log.isErrorEnabled();
+ default:
+ return true;
+ }
+ }
+}
Propchange: velocity/engine/trunk/src/java/org/apache/velocity/runtime/log/CommonsLogLogChute.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: velocity/engine/trunk/src/java/org/apache/velocity/runtime/log/CommonsLogLogChute.java
------------------------------------------------------------------------------
svn:keywords = Revision
Re: svn commit: r524893 - in /velocity/engine/trunk: build/build.properties
Posted by Nathan Bubna <nb...@gmail.com>.
See r524894
On 4/8/07, Henning P. Schmiedehausen <hp...@intermeta.de> wrote:
> nbubna@apache.org writes:
>
> >Author: nbubna
> >Date: Mon Apr 2 12:27:29 2007
> >New Revision: 524893
>
> [...]
> > # Needs to be configured with system location of javacc for parser task
> >-javacc.home= *unset*
> >+javacc.home= C:/java/java.net/javacc
>
> That one slipped you through.
>
> Best regards
> Henning
>
> --
> Henning P. Schmiedehausen -- hps@intermeta.de | J2EE, Linux, |gls
> 91054 Buckenhof, Germany -- +49 9131 506540 | Apache person |eau
> Open Source Consulting, Development, Design | Velocity - Turbine guy |rwc
> |m k
> INTERMETA - Gesellschaft fuer Mehrwertdienste mbH - RG Fuerth, HRB 7350 |a s
> Sitz der Gesellschaft: Buckenhof. Geschaeftsfuehrer: Henning Schmiedehausen |n
>
> "Save the cheerleader. Save the world."
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
> For additional commands, e-mail: dev-help@velocity.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org
Re: svn commit: r524893 - in /velocity/engine/trunk: build/build.properties
Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
nbubna@apache.org writes:
>Author: nbubna
>Date: Mon Apr 2 12:27:29 2007
>New Revision: 524893
[...]
> # Needs to be configured with system location of javacc for parser task
>-javacc.home= *unset*
>+javacc.home= C:/java/java.net/javacc
That one slipped you through.
Best regards
Henning
--
Henning P. Schmiedehausen -- hps@intermeta.de | J2EE, Linux, |gls
91054 Buckenhof, Germany -- +49 9131 506540 | Apache person |eau
Open Source Consulting, Development, Design | Velocity - Turbine guy |rwc
|m k
INTERMETA - Gesellschaft fuer Mehrwertdienste mbH - RG Fuerth, HRB 7350 |a s
Sitz der Gesellschaft: Buckenhof. Geschaeftsfuehrer: Henning Schmiedehausen |n
"Save the cheerleader. Save the world."
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org