Class LogContext
- java.lang.Object
-
- org.apache.velocity.runtime.parser.LogContext
-
public class LogContext extends Object
Track location in template files during rendering by populating the slf4j MDC tags
file
,line
andcolumn
.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:$
- Author:
- Claude Brisson
-
-
Constructor Summary
Constructors Constructor Description LogContext(boolean trackLocation)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String[]
getStackTrace()
void
popLogContext()
void
pushLogContext(SimpleNode src, Info info)
-
-
-
Field Detail
-
logger
protected static org.slf4j.Logger logger
-
MDC_FILE
public static final String MDC_FILE
- See Also:
- Constant Field Values
-
MDC_LINE
public static final String MDC_LINE
- See Also:
- Constant Field Values
-
MDC_COLUMN
public static final String MDC_COLUMN
- See Also:
- Constant Field Values
-
-
Method Detail
-
pushLogContext
public void pushLogContext(SimpleNode src, Info info)
-
popLogContext
public void popLogContext()
-
getStackTrace
public String[] getStackTrace()
-
-