Author: tv
Date: Sun Aug 25 16:05:03 2013
New Revision: 1517324
URL: http://svn.apache.org/r1517324
Log:
Fix velocity logging
Modified:
turbine/core/trunk/src/changes/changes.xml
turbine/core/trunk/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java
Modified: turbine/core/trunk/src/changes/changes.xml
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/changes/changes.xml?rev=1517324&r1=1517323&r2=1517324&view=diff
==============================================================================
--- turbine/core/trunk/src/changes/changes.xml (original)
+++ turbine/core/trunk/src/changes/changes.xml Sun Aug 25 16:05:03 2013
@@ -25,7 +25,10 @@
<body>
<release version="4.0-M2" date="in Subversion">
- <action type="update" dev="gk">
+ <action type="fix" dev="tv">
+ Fix Velocity logging.
+ </action>
+ <action type="update" dev="gk">
Reintroduce VelocityCachedLayout/Screen classes
</action>
<action type="update" dev="tv">
Modified:
turbine/core/trunk/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java?rev=1517324&r1=1517323&r2=1517324&view=diff
==============================================================================
---
turbine/core/trunk/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java
(original)
+++
turbine/core/trunk/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java
Sun Aug 25 16:05:03 2013
@@ -44,6 +44,7 @@ import org.apache.turbine.util.RunData;
import org.apache.turbine.util.TurbineException;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
+import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.app.event.EventCartridge;
import org.apache.velocity.app.event.MethodExceptionEventHandler;
import org.apache.velocity.context.Context;
@@ -109,6 +110,9 @@ public class TurbineVelocityService
/** Shall we catch Velocity Errors and report them in the log file? */
private boolean catchErrors = true;
+ /** Velocity runtime instance */
+ private VelocityEngine velocity = null;
+
/** Internal Reference to the pull Service */
private PullService pullService = null;
@@ -444,7 +448,8 @@ public class TurbineVelocityService
{
encoding = defaultOutputEncoding;
}
- Velocity.mergeTemplate(filename, encoding, context, writer);
+
+ velocity.mergeTemplate(filename, encoding, context, writer);
}
/**
@@ -518,11 +523,12 @@ public class TurbineVelocityService
conf.setProperty(Velocity.RUNTIME_LOG_LOGSYSTEM_CLASS,
Log4JLogChute.class.getName());
- conf.setProperty(Velocity.RUNTIME_LOG_LOGSYSTEM
- + ".log4j.category", "velocity");
+ conf.setProperty(Log4JLogChute.RUNTIME_LOG_LOG4J_LOGGER,
+ "velocity");
- Velocity.setExtendedProperties(createVelocityProperties(conf));
- Velocity.init();
+ velocity = new VelocityEngine();
+ velocity.setExtendedProperties(createVelocityProperties(conf));
+ velocity.init();
}
@@ -577,8 +583,6 @@ public class TurbineVelocityService
continue; // for()
}
- Velocity.clearProperty(key);
-
// Translate the supplied pathes given here.
// the following three different kinds of
// pathes must be translated to be webapp-relative
@@ -641,7 +645,7 @@ public class TurbineVelocityService
@Override
public boolean templateExists(String template)
{
- return Velocity.resourceExists(template);
+ return velocity.resourceExists(template);
}
/**