Class LogContext
java.lang.Object
org.apache.velocity.runtime.parser.LogContext
Track location in template files during rendering by populating the slf4j MDC tags file
, line
and column
.
An MDC-aware logger can then use this info to display the template location in the message
For instance with webapp-slf4j-logger, it's enough to use %file
, %line
and %column
in the logger format string.
Since this feature can have a performance impact, it has to be enabled in velocity.properties
using:
runtime.log.track_location = true
(typically in a development environment)
- Since:
- 2.2
- Version:
- $Id:$
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static ThreadLocal
<Deque<LogContext.StackElement>> protected static org.slf4j.Logger
static final String
static final String
static final String
private static final String
private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
String[]
void
void
pushLogContext
(SimpleNode src, Info info) private void
setLogContext
(Info info)
-
Field Details
-
logger
protected static org.slf4j.Logger logger -
MDC_FILE
- See Also:
-
MDC_LINE
- See Also:
-
MDC_COLUMN
- See Also:
-
trackLocation
private boolean trackLocation -
contextStack
-
STACKTRACE_LINE
- See Also:
-
-
Constructor Details
-
LogContext
public LogContext(boolean trackLocation)
-
-
Method Details
-
pushLogContext
-
popLogContext
public void popLogContext() -
setLogContext
-
clearLogContext
private void clearLogContext() -
getStackTrace
-