@Deprecated public class TimerInterceptor extends AbstractInterceptor
trace, debug, info, warn, error, fatal
)? - defaut is info
com.mycompany.app
).
Default is to use com.opensymphony.xwork2.interceptor.TimerInterceptor
.invokeUnderTiming
method.
<!-- records only the action's execution time --> <action name="someAction" class="com.examples.SomeAction"> <interceptor-ref name="completeStack"/> <interceptor-ref name="timer"/> <result name="success">good_result.ftl</result> </action> <!-- records action's execution time as well as other interceptors--> <action name="someAction" class="com.examples.SomeAction"> <interceptor-ref name="timer"/> <interceptor-ref name="completeStack"/> <result name="success">good_result.ftl</result> </action>This second example uses our own log category at debug level.
<!-- records only the action's execution time --> <action name="someAction" class="com.examples.SomeAction"> <interceptor-ref name="completeStack"/> <interceptor-ref name="timer"> <param name="logLevel">debug</param> <param name="logCategory">com.mycompany.myapp.actiontime</param> <interceptor-ref/> <result name="success">good_result.ftl</result> </action> <!-- records action's execution time as well as other interceptors--> <action name="someAction" class="com.examples.SomeAction"> <interceptor-ref name="timer"/> <interceptor-ref name="completeStack"/> <result name="success">good_result.ftl</result> </action>
Modifier and Type | Field and Description |
---|---|
protected org.apache.logging.log4j.Logger |
categoryLogger
Deprecated.
|
protected String |
logCategory
Deprecated.
|
protected String |
logLevel
Deprecated.
|
Constructor and Description |
---|
TimerInterceptor()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected void |
doLog(org.apache.logging.log4j.Logger logger,
String message)
Deprecated.
Performs the actual logging.
|
String |
getLogCategory()
Deprecated.
|
protected org.apache.logging.log4j.Logger |
getLoggerToUse()
Deprecated.
Get's the logger to use.
|
String |
getLogLevel()
Deprecated.
|
String |
intercept(ActionInvocation invocation)
Deprecated.
Override to handle interception
|
protected String |
invokeUnderTiming(ActionInvocation invocation)
Deprecated.
Is called to invoke the action invocation and time the execution time.
|
void |
setLogCategory(String logCatgory)
Deprecated.
|
void |
setLogLevel(String logLevel)
Deprecated.
|
protected boolean |
shouldLog()
Deprecated.
Determines if we should log the time.
|
destroy, init
protected org.apache.logging.log4j.Logger categoryLogger
protected String logCategory
protected String logLevel
public String getLogCategory()
public void setLogCategory(String logCatgory)
public String getLogLevel()
public void setLogLevel(String logLevel)
public String intercept(ActionInvocation invocation) throws Exception
AbstractInterceptor
intercept
in interface Interceptor
intercept
in class AbstractInterceptor
invocation
- the action invocationActionInvocation.invoke()
, or from the interceptor itself.Exception
- any system-level error, as defined in Action.execute()
.protected String invokeUnderTiming(ActionInvocation invocation) throws Exception
invocation
- the action invocation.Exception
- can be thrown from the action.protected boolean shouldLog()
protected org.apache.logging.log4j.Logger getLoggerToUse()
protected void doLog(org.apache.logging.log4j.Logger logger, String message)
logger
- the provided logger to use.message
- the message to log.Copyright © 2000–2020 Apache Software Foundation. All rights reserved.