aboutsummaryrefslogtreecommitdiff
path: root/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
diff options
context:
space:
mode:
Diffstat (limited to 'velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java')
-rw-r--r--velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java24
1 files changed, 22 insertions, 2 deletions
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
index 498d7aaf..c72491a6 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
@@ -37,6 +37,7 @@ import org.apache.velocity.runtime.directive.Directive;
import org.apache.velocity.runtime.directive.Macro;
import org.apache.velocity.runtime.directive.Scope;
import org.apache.velocity.runtime.directive.StopCommand;
+import org.apache.velocity.runtime.parser.LogContext;
import org.apache.velocity.runtime.parser.ParseException;
import org.apache.velocity.runtime.parser.Parser;
import org.apache.velocity.runtime.parser.node.Node;
@@ -120,7 +121,7 @@ public class RuntimeInstance implements RuntimeConstants, RuntimeServices
/**
* The Runtime parser pool
*/
- private ParserPool parserPool;
+ private ParserPool parserPool;
/**
* Indicate whether the Runtime is in the midst of initialization.
@@ -136,7 +137,7 @@ public class RuntimeInstance implements RuntimeConstants, RuntimeServices
* These are the properties that are laid down over top
* of the default properties when requested.
*/
- private ExtProperties overridingProperties = null;
+ private ExtProperties overridingProperties = null;
/**
* This is a hashtable of initialized directives.
@@ -220,6 +221,11 @@ public class RuntimeInstance implements RuntimeConstants, RuntimeServices
private boolean hyphenAllowedInIdentifiers;
/**
+ * The LogContext object used to track location in templates
+ */
+ private LogContext logContext;
+
+ /**
* Creates a new RuntimeInstance object.
*/
public RuntimeInstance()
@@ -952,6 +958,10 @@ public class RuntimeInstance implements RuntimeConstants, RuntimeServices
}
/* else keep our default Velocity logger
*/
+
+ /* Initialize LogContext */
+ boolean trackLocation = getBoolean(RUNTIME_LOG_TRACK_LOCATION, false);
+ logContext = new LogContext(trackLocation);
}
catch (Exception e)
{
@@ -1672,6 +1682,16 @@ public class RuntimeInstance implements RuntimeConstants, RuntimeServices
}
/**
+ * Get the LogContext object used to tack locations in templates.
+ * @return LogContext object
+ * @since 2.2
+ */
+ public LogContext getLogContext()
+ {
+ return logContext;
+ }
+
+ /**
* String property accessor method with default to hide the
* configuration implementation.
*