org.perf4j.aop
Annotation Type Profiled


@Retention(value=RUNTIME)
@Target(value={METHOD,CONSTRUCTOR})
public @interface Profiled

The Profiled annotation is used in concert with the log4j or javalog TimingAspects to enable unobtrusive performance logging. Methods with this annotation, when enabled with the TimingAspect, will automatically have their execution time logged.

Author:
Alex Devine
See Also:
The Perf4J Developer Guide Profiled Annotations Overview

Optional Element Summary
 boolean el
          Whether or not the tag and message elements should support Java Expression Language syntax.
 boolean logFailuresSeparately
          Whether or not separate tags should be used depending on whether or not the annotated method returns normally or by throwing an exception.
 java.lang.String logger
          The name of the logger (either a log4J or java.logging Logger, depending on the Aspect in use at runtime) to use to log the StopWatch.
 java.lang.String message
          The optional message element can be used to set a message on the StopWatch that is logged.
 java.lang.String tag
          The tag that should be set on the StopWatch when the execution time is logged.
 

tag

public abstract java.lang.String tag
The tag that should be set on the StopWatch when the execution time is logged. If not specified then the name of the method being annotated will be used for the tag name.

Returns:
The StopWatch tag
Default:
"@@USE_METHOD_NAME"

message

public abstract java.lang.String message
The optional message element can be used to set a message on the StopWatch that is logged.

Returns:
The optional message specified for this annotation.
Default:
""

logger

public abstract java.lang.String logger
The name of the logger (either a log4J or java.logging Logger, depending on the Aspect in use at runtime) to use to log the StopWatch.

Returns:
The logger name, defaults to StopWatch.DEFAULT_LOGGER_NAME
Default:
"org.perf4j.TimingLogger"

el

public abstract boolean el
Whether or not the tag and message elements should support Java Expression Language syntax. Setting this to true enables the tag name to be dynamic with respect to the arguments passed to the method being profiled. An Expression Language expression is delimited with curly brackets, and arguments are accessed as $0, $1, $2, etc. For example, suppose you want to profile the doGet() method of a servlet, with the tag name dependent on the path info (as returned by getPathInfo()) of the request. You could create the following annotation:
 @Profiled(tag = "myServlet{$0.pathInfo}", el = true)
 protected void doGet(HttpServletRequest req, HttpServletResponse res) {
 ...
 }
 
If the doGet() method is called with a request whose getPathInfo() method returns "/sub/path", then the tag used when logging a StopWatch will be "myServlet/sub/path".

Returns:
True if expression language support should be enabled, false to disable support - defaults to true.
Default:
true

logFailuresSeparately

public abstract boolean logFailuresSeparately
Whether or not separate tags should be used depending on whether or not the annotated method returns normally or by throwing an exception. If true, then when the method returns normally the tag name used is tag() + ".success", when the method throws an exception the tag name used is tag() + ".failure".

Returns:
Whether or not failures should be logged under a separate tag, defaults to false.
Default:
false


Copyright © 2008 perf4j.org. All Rights Reserved.