|
IBM Rational Performance Tester SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IKLog
Interface for logging data, messages, or verification points from within custom code actions.
Most developed code has a need to handle error conditions, anomalies in expected data, or other abstract conditions that would cause them to report such a problem. Further, sometimes custom code will want to make a comparison (verification) and report on the outcome.
The IKLog interface is the preferred way for all actions, including all custom code, to report on these circumstances. It is also the interface for conveying informational or status messages that may be of interest after the completion of a test.
The interface contains constants used to delineate the type of data being presented, methods for determining the categories of data requested by the tester (at the workbench), and methods for sending the messages to the logging subsystem.
NOTE: Some methods and constants are marked "Internal use only". Please do not call or use them as they may have repercussions you would not anticipate.
USING IKLog FROM CUSTOM CODE (ICustomCode)
To use the IKLog interface from custom code, first determine what it is that you want to log. Is the message about an error that occurred, or simply informational? Does it require that the tester do something or is it just an anomaly that occurred?
Once you have determined what the message is about, examine the constants defined in this class to choose the best fit. For simple log messages:
LOG_SEVERE |
Log a severe message. These are messages that indicate that fidelity has been compromised by a problem. |
LOG_WARNING |
Log a warning message. Warning messages indicate that the run experienced an unexpected condition, but that it has recovered and is continuing execution. |
LOG_INFO |
Log an informational message. Informational messages are, as the name suggests, messages indicating, not a problem, but that a particular state was achieved. |
The remainder of the log levels are primarily used only internally by the IBM Rational Performance Tester product when seeking to convey information used to debug the inner workings of the system. |
The next decision to be made is whether or not the message level you are logging is of interest to the workbench (is anybody listening?).
Make a call to wouldLog(...)
to determine if you should bother
even sending the message. For example:
if (wouldLog(LOG_INFO))
log(LOG_INFO, "Hello, World, I see you are interested");
NOTE: Making a call to wouldLog()
(or wouldReportHistory()
for verification points) before logging any information is
a preferred practice as it improves performance when the logging levels are
more restrictive. Further, avoid creating a String that contains the output to be sent
if the output is being filtered.
If you are doing comparisons in your custom code (for example, verifying that some piece of data appeared on an HTML page), you will want to report the verdict of the the verification either as a String or as a VerdictEvent (part of the TPTP testing infrastructure). Either way, you will want to peruse the documentation for VerdictEvent to understand the meaning of each of the VerdictEvent constants used as verdicts.
Make a call to wouldReportHistory()
before issuing an event:
if (wouldReportEvent(HISTORY_ALL))
reportVerificationPoint("x != y", VerdictEvent.VERDICT_FAIL);
The detail of execution history events reported on the workbench is determined by the settings applied to the schedule. Not all events are reported. They are reported according to the following hierarchy (getting more restrictive as we go):
HISTORY_ALL | report all events |
HISTORY_REQUESTS | only report events down to the individual request |
HISTORY_PAGES | only report events related to a page |
HISTORY_SCHEDULE | only report events related to the schedule (test start/stop, etc.) |
Field Summary | |
---|---|
static int |
HISTORY_ALL
(HTTP) Report most detailed execution history events. |
static int |
HISTORY_NONE
Don't report any execution history. |
static int |
HISTORY_PAGES
(HTTP) Report execution history events down to the page level. |
static int |
HISTORY_REQUESTS
(HTTP) Report execution history events down to the request level. |
static int |
HISTORY_SCHEDULE
Report execution history events that correspond to actions found in the schedule behavior model. |
static int |
LOG_ALL
Highest (most verbose) log level. |
static int |
LOG_CONFIG
Log message at the 'config' level. |
static int |
LOG_FINE
Log debug message at the 'fine' level (least amount of debugging output). |
static int |
LOG_FINER
Log debug message at the 'finer' level (medium amount of debugging output). |
static int |
LOG_FINEST
Log debug message at the 'finest' level (most debugging output) . |
static int |
LOG_INFO
Log message at the 'informational' level. |
static int |
LOG_NONE
Don't log the message. |
static int |
LOG_SEVERE
Log message at the 'severe' level (errors). |
static int |
LOG_WARNING
Log message at the 'warning' level. |
static int |
STATISTIC_ALL
Report all statistical counters. |
static int |
STATISTIC_NONE
Report no statistics. |
static int |
STATISTIC_PAGES
Report a moderate number of statistical counters. |
Method Summary | |
---|---|
int |
getHistoryLevel()
Get the execution history level. |
int |
getHistoryLevel(int filter)
Get the execution history level. |
int |
getLogLevel()
Get the current active log level. |
int |
getStatisticsLevel()
|
int |
getVirtualUserGUID()
Return an integer assigned to the Virtual User. |
void |
log(int logLevel,
Object msg)
Send a message (conditionally) to the log. |
void |
log(int logLevel,
Object msg,
Throwable e)
Send a message with a stack trace (conditionally) to the log. |
void |
log(Object msg)
Send a message to the log if the calling virtual user is one of those being sampled. |
void |
log(Object msg,
Throwable e)
Send a message with a stack trace to the log if the calling virtual user is one of those being sampled. |
void |
reportEvent(org.eclipse.hyades.test.common.event.ExecutionEvent event)
Report a TPTP ExecutionEvent to the execution history if the calling virtual user is being sampled. |
void |
reportEvent(org.eclipse.hyades.test.common.event.ExecutionEvent event,
boolean override)
Reports a TPTP ExecutionEvent to the test log if the calling virtual user is being sampled. |
void |
reportEvent(org.eclipse.hyades.test.common.event.ExecutionEvent event,
int historyType)
Report a TPTP ExecutionEvent to the execution history if the calling virtual user is being sampled. |
void |
reportMessage(String msg)
Create a TPTP MessageEvent and place it in the execution history. |
void |
reportMessage(String msg,
int severity)
Create a TPTP MessageEvent and place it in the execution history. |
void |
reportMessage(String msg,
int severity,
int historyType)
Create a TPTP MessageEvent and place it in the execution history. |
void |
reportVerdict(String txt,
int verdict)
Create a TPTP VerdictEvent and place it in the execution history. |
void |
reportVerdict(String txt,
int verdict,
int reason)
Create a TPTP VerdictEvent and place it in the execution history. |
void |
reportVerdict(String txt,
int verdict,
int reason,
String cause)
Create a TPTP VerdictEvent and place it in the execution history. |
void |
reportVerdict(org.eclipse.hyades.test.common.event.VerdictEvent event)
Report a TPTP VerdictEvent. |
void |
reportVerificationPoint(String name,
int verdict)
Create a TPTP VerdictEvent and place it in the execution history. |
void |
reportVerificationPoint(String name,
int verdict,
String text)
Create a TPTP VerdictEvent and place it in the execution history. |
void |
reportVerificationPoint(String name,
int verdict,
String text,
int reason)
Create a TPTP VerdictEvent and place it in the execution history. |
void |
reportVerificationPoint(String name,
int verdict,
String text,
int reason,
String cause)
Create a TPTP VerdictEvent and place it in the execution history. |
void |
reportVerificationPoint(org.eclipse.hyades.test.common.event.VerdictEvent vp)
Report a user created TPTP VerdictEvent as a user defined verification point. |
void |
reportVerificationPoint(org.eclipse.hyades.test.common.event.VerdictEvent vp,
com.ibm.rational.test.lt.kernel.statistics.IVerificationPoint vpStat)
Report a TPTP VerdictEvent as a verification point. |
boolean |
wouldARM()
Return true iff the calling virual user is being sampled for ARM processing. |
boolean |
wouldLog(int logLevel)
Return true iff a log message of the given logLevel would log. |
boolean |
wouldReportHistory(int historyLevel)
Return true iff an execution history event of the given historyLevel would be delivered. |
boolean |
wouldReportHistory(int historyLevel,
int filter)
Return true iff an execution history event of the given historyLevel would be delivered. |
boolean |
wouldReportStatistics(int statisticsLevel)
Determine if the current execution would report statistics at a given level. |
Field Detail |
---|
static final int LOG_ALL
Best not to log messages at this level.
Internal use only.
IKLog.LOG_FINE
,
IKLog.LOG_FINER
,
IKLog.LOG_FINEST
,
Constant Field Valuesstatic final int LOG_FINEST
Internal use only.
IKLog.LOG_FINE
,
IKLog.LOG_FINER
,
Constant Field Valuesstatic final int LOG_FINER
Internal use only.
IKLog.LOG_FINE
,
IKLog.LOG_FINEST
,
Constant Field Valuesstatic final int LOG_FINE
Internal use only.
IKLog.LOG_FINER
,
IKLog.LOG_FINEST
,
Constant Field Valuesstatic final int LOG_CONFIG
Output messages to this level if the data to be presented relates to the particular configuration of the kernel, the engine, or some other subsystem.
Internal use only.
static final int LOG_INFO
Used by all Kernel subsystems and by custom code developers, the
LOG_INFO
level is used to provide messages that relay
important state information, but do not indicate that a significant
problem has occurred or that any action that must be performed in response.
IKLog.LOG_WARNING
,
IKLog.LOG_SEVERE
,
Constant Field Valuesstatic final int LOG_WARNING
Used by all Kernel subsystems and by custom code developers, the
LOG_WARNING
level is used to relay messages about
unexpected issues (usually involving unexpected data values).
Use this level to indicate that a significant problem has occurred but that execution will proceed anyway and that no action need be performed in response.
IKLog.LOG_INFO
,
IKLog.LOG_SEVERE
,
Constant Field Valuesstatic final int LOG_SEVERE
Used by all Kernel subsystems and by custom code developers, the
LOG_SEVERE
level is used to relay messages about
unexpected issues in the execution of the subsystem (usually indicating
an inability to proceed in any normal fashion).
Use this level to indicate that a significant problem has occurred and that execution should be terminated. Information should be logged that would indicate the course of action to perform in response.
IKLog.LOG_INFO
,
IKLog.LOG_WARNING
,
Constant Field Valuesstatic final int LOG_NONE
Internal use only.
static final int HISTORY_NONE
Internal use only.
static final int HISTORY_SCHEDULE
This level shows high level events down to and including test invocations. However no events generated by the test behavior model are included in the execution history.
IKLog.HISTORY_ALL
,
IKLog.HISTORY_REQUESTS
,
IKLog.HISTORY_PAGES
,
Constant Field Valuesstatic final int HISTORY_PAGES
This level shows events down to and including page start, page stop, and page level verification points. No individual http requests are represented in the execution history.
IKLog.HISTORY_ALL
,
IKLog.HISTORY_PAGES
,
IKLog.HISTORY_SCHEDULE
,
Constant Field Valuesstatic final int HISTORY_REQUESTS
This level shows events down to and including individual http requests and request level verification points. The actual content of the request or response is not reported.
IKLog.HISTORY_REQUESTS
,
IKLog.HISTORY_PAGES
,
IKLog.HISTORY_SCHEDULE
,
Constant Field Valuesstatic final int HISTORY_ALL
This level shows all events down to and including individual http requests and request level verification points. The actual content of the request or response is reported and visible via the protocol data view.
IKLog.HISTORY_REQUESTS
,
IKLog.HISTORY_PAGES
,
IKLog.HISTORY_SCHEDULE
,
Constant Field Valuesstatic final int STATISTIC_NONE
Internal use only.
static final int STATISTIC_PAGES
(HTTP) report statistics related to pages but not individual requests.
IKLog.STATISTIC_ALL
,
Constant Field Valuesstatic final int STATISTIC_ALL
(HTTP) report statistics related to individual http requests.
IKLog.STATISTIC_PAGES
,
Constant Field ValuesMethod Detail |
---|
int getLogLevel()
boolean wouldLog(int logLevel)
This takes into account the log level and whether or not the calling virtual user is one of those for whom sampling is active.
logLevel
- the logLevel of the proposed message
void log(Object msg)
equivalent to log(IKLog.LOG_SEVERE, msg)
msg
- the message to be loggedvoid log(Object msg, Throwable e)
equivalent to log(IKLog.LOG_SEVERE, msg, e)
msg
- the message to be loggede
- the exception for which a stack trace is to be logged.void log(int logLevel, Object msg)
If the current log level is greater than or equal to the logLevel specified for the message, and the calling virtual user is being sampled, the message will be sent.
logLevel
- the log level at which to send this messagemsg
- the message to be loggedvoid log(int logLevel, Object msg, Throwable e)
If the current log level is greater than or equal to the logLevel specified for the message, and the calling virtual user is being sampled, the message will be sent.
logLevel
- the log level at which to send this messagemsg
- the message to be loggede
- the exception for which a stack trace is to be logged.int getHistoryLevel()
int getHistoryLevel(int filter)
filter
- the fliter for which the historyLevel is wanted.
boolean wouldReportHistory(int historyLevel)
This takes into account the history Level and the whether or not the calling virtual user is being sampled.
historyLevel
- the historyLevel of the proposed event
boolean wouldReportHistory(int historyLevel, int filter)
This takes into account the history Level and the whether or not the calling virtual user is being sampled.
historyLevel
- the historyLevel of the proposed event.filter
- the filter that applies to the event in question.
void reportEvent(org.eclipse.hyades.test.common.event.ExecutionEvent event)
If the event.timestamp is not set, reportEvent sets it to the current time. ReportEvent() also sets the event id's correctly so that the event shows up in the proper place in the execution history
after reporting an event with reportEvent, the event's id can be gotten by event.getId() and used for another event's parentId. This will make the second event a child of the first in the execution history.
event
- the TPTP ExecutionEvent to report.void reportEvent(org.eclipse.hyades.test.common.event.ExecutionEvent event, int historyType)
If the event.timestamp is not set, reportEvent sets it to the current time. reportEvent() also sets the event id's correctly so that the event shows up in the proper place in the execution history
after reporting an event with reportEvent, the event's id can be gotten by event.getId() and used for another event's parentId. This will make the second event a child of the first in the execution history.
event
- the TPTP ExecutionEvent to report.historyType
- the history level for which this event should appearvoid reportEvent(org.eclipse.hyades.test.common.event.ExecutionEvent event, boolean override)
If the event.timestamp is not set, reportEvent sets it to the current time. reportEvent() also sets the event id's correctly so that the event displays in the proper place in the test log.
After reporting an event with reportEvent, the event's id can be gotten by event.getId() and used for another event's parentId. This will make the second event a child of the first in the test log.
If the event would not be logged because of current testLog level or verdict or severity, but the event is to become the parent of another event which would be logged, then specifying an override of true will cause this event to be include in the testLog.
event
- The TPTP ExecutionEvent to report.override
- A flag that when true indicates that this event is to be logged regardless of
level, severity, or verdict.void reportMessage(String msg, int severity, int historyType)
msg
- the text of the message eventseverity
- the severity of the message eventhistoryType
- the history level for which this event should appearvoid reportMessage(String msg, int severity)
msg
- the text of the message eventseverity
- the severity of the message eventvoid reportMessage(String msg)
msg
- the text of the message eventvoid reportVerdict(String txt, int verdict, int reason, String cause)
VerdictEvents reported by this method will contribute to the rollup of verdicts by the parent containers.
If other features (such as property lists, eventType, or name) of a TPTP VerdictEvent are desired, creat a verdictEvent and report it with reportVerdict(VerdictEvent).
txt
- the text for the verdictEventverdict
- the verdict for the verdictEvent. must be one of:
VerdictEvent.VERDICT_INCONCLUSIVE | the verdict cannot be determined |
VerdictEvent.VERDICT_PASS | the testcase passes |
VerdictEvent.VERDICT_FAIL | the testcase fails |
VerdictEvent.VERDICT_ERROR | an error occured while processing the testcase |
reason
- the reason for the verdictEvent. must be one of:
VerdictEvent.REASON_UNKNOWN | the reason for the verdict is unknown |
VerdictEvent.REASON_NONE | there is no reason |
VerdictEvent.REASON_SEE_DESCRIPTION | more information is in the txt parameter |
VerdictEvent.REASON_ABORT | the processing of the testcase was aborted |
VerdictEvent.REASON_DID_NOT_COMPLETE | the testcase was not completed |
cause
- the id of an existing execution history event which caused this verdictvoid reportVerdict(String txt, int verdict, int reason)
VerdictEvents reported by this method will contribute to the rollup of verdicts by the parent containers.
If other features (such as property lists, eventType, or name) of a TPTP VerdictEvent are desired, creat a verdictEvent and report it with reportVerdict(VerdictEvent).
txt
- the text for the verdictEventverdict
- the verdict for the verdictEvent. must be one of:
VerdictEvent.VERDICT_INCONCLUSIVE | the verdict cannot be determined |
VerdictEvent.VERDICT_PASS | the testcase passes |
VerdictEvent.VERDICT_FAIL | the testcase fails |
VerdictEvent.VERDICT_ERROR | an error occured while processing the testcase |
reason
- the reason for the verdictEvent. must be one of:
VerdictEvent.REASON_UNKNOWN | the reason for the verdict is unknown |
VerdictEvent.REASON_NONE | there is no reason |
VerdictEvent.REASON_SEE_DESCRIPTION | more information is in the txt parameter |
VerdictEvent.REASON_ABORT | the processing of the testcase was aborted |
VerdictEvent.REASON_DID_NOT_COMPLETE | the testcase was not completed |
void reportVerdict(String txt, int verdict)
VerdictEvents reported by this method will contribute to the rollup of verdicts by the parent containers.
The reason for this verdictEvent will be VerdictEvent.REASON_NONE.
If other features (such as property lists, eventType, or name) of a TPTP VerdictEvent are desired, creat a verdictEvent and report it with reportVerdict(VerdictEvent).
txt
- the text for the verdictEventverdict
- the verdict for the verdictEvent. must be one of:
VerdictEvent.VERDICT_INCONCLUSIVE | the verdict cannot be determined |
VerdictEvent.VERDICT_PASS | the testcase passes |
VerdictEvent.VERDICT_FAIL | the testcase fails |
VerdictEvent.VERDICT_ERROR | an error occured while processing the testcase |
void reportVerdict(org.eclipse.hyades.test.common.event.VerdictEvent event)
It is up to the caller to instantiate the event and set all fields (except for id, parentId, and timestamp) as desired. This differs from reportEvent() in that verdicts reported via this method will contribute to the rollup of verdicts by the parent containers.
event
- the TPTP VerdictEvent to report.void reportVerificationPoint(String name, int verdict)
VerdictEvents reported by this method will contribute to the rollup of verdicts by the parent containers. Statistics for the number of vp's of each possible verdict are kept and reported to the statistical model.
The reason for this verdictEvent will be VerdictEvent.REASON_NONE.
If other features (such as property lists, eventType, or name) of a TPTP VerdictEvent are desired, creat a verdictEvent and report it with reportVerificationPoint(VerdictEvent) below.
name
- the name of the verification point (for statistical reference)verdict
- the verdict for the verdictEvent. must be one of:
VerdictEvent.VERDICT_INCONCLUSIVE | the verdict cannot be determined |
VerdictEvent.VERDICT_PASS | the testcase passes |
VerdictEvent.VERDICT_FAIL | the testcase fails |
VerdictEvent.VERDICT_ERROR | an error occured while processing the testcase |
void reportVerificationPoint(String name, int verdict, String text)
VerdictEvents reported by this method will contribute to the rollup of verdicts by the parent containers. Statistics for the number of vp's of each possible verdict are kept and reported to the statistical model.
The reason for this verdictEvent will be VerdictEvent.REASON_NONE.
If other features (such as property lists, eventType, or name) of a TPTP VerdictEvent are desired, creat a verdictEvent and report it with reportVerificationPoint(VerdictEvent) below.
name
- the name of the verification point (for statistical reference)verdict
- the verdict for the verdictEvent. must be one of:
VerdictEvent.VERDICT_INCONCLUSIVE | the verdict cannot be determined |
VerdictEvent.VERDICT_PASS | the testcase passes |
VerdictEvent.VERDICT_FAIL | the testcase fails |
VerdictEvent.VERDICT_ERROR | an error occured while processing the testcase |
text
- the text for the verdictEventvoid reportVerificationPoint(String name, int verdict, String text, int reason)
VerdictEvents reported by this method will contribute to the rollup of verdicts by the parent containers. Statistics for the number of vp's of each possible verdict are kept and reported to the statistical model.
If other features (such as property lists, eventType, or name) of a TPTP VerdictEvent are desired, creat a verdictEvent and report it with reportVerificationPoint(VerdictEvent) below.
name
- the name of the verification point (for statistical reference)verdict
- the verdict for the verdictEvent. must be one of:
VerdictEvent.VERDICT_INCONCLUSIVE | the verdict cannot be determined |
VerdictEvent.VERDICT_PASS | the testcase passes |
VerdictEvent.VERDICT_FAIL | the testcase fails |
VerdictEvent.VERDICT_ERROR | an error occured while processing the testcase |
text
- the text for the verdictEventreason
- the reason for the verdictEvent. must be one of
VerdictEvent.REASON_UNKNOWN | the reason for the verdict is unknown |
VerdictEvent.REASON_NONE | there is no reason |
VerdictEvent.REASON_SEE_DESCRIPTION | more information is in the txt parameter |
VerdictEvent.REASON_ABORT | the processing of the testcase was aborted |
VerdictEvent.REASON_DID_NOT_COMPLETE | the testcase was not completed |
void reportVerificationPoint(String name, int verdict, String text, int reason, String cause)
VerdictEvents reported by this method will contribute to the rollup of verdicts by the parent containers. Statistics for the number of vp's of each possible verdict are kept and reported to the statistical model.
If other features (such as property lists, eventType, or name) of a TPTP VerdictEvent are desired, creat a verdictEvent and report it with reportVerificationPoint(VerdictEvent) below.
name
- the name of the verification point (for statistical reference)verdict
- the verdict for the verdictEvent. must be one of:
VerdictEvent.VERDICT_INCONCLUSIVE | the verdict cannot be determined |
VerdictEvent.VERDICT_PASS | the testcase passes |
VerdictEvent.VERDICT_FAIL | the testcase fails |
VerdictEvent.VERDICT_ERROR | an error occured while processing the testcase |
text
- the text for the verdictEventreason
- the reason for the verdictEvent. must be one of
VerdictEvent.REASON_UNKNOWN | the reason for the verdict is unknown |
VerdictEvent.REASON_NONE | there is no reason |
VerdictEvent.REASON_SEE_DESCRIPTION | more information is in the txt parameter |
VerdictEvent.REASON_ABORT | the processing of the testcase was aborted |
VerdictEvent.REASON_DID_NOT_COMPLETE | the testcase was not completed |
cause
- the id of an existing execution history event which caused this verdictvoid reportVerificationPoint(org.eclipse.hyades.test.common.event.VerdictEvent vp)
VerdictEvents reported by this method will contribute to the rollup of verdicts by the parent containers. Statistics for the number of vp's of each possible verdict are kept and reported to the statistical model.
vp
- the TPTP VerdictEvent to report as a verification point.void reportVerificationPoint(org.eclipse.hyades.test.common.event.VerdictEvent vp, com.ibm.rational.test.lt.kernel.statistics.IVerificationPoint vpStat)
VerdictEvents reported by this method will contribute to the rollup of verdicts by the parent containers. The counter for the verdict in the given VerificationPoint statistics counter is incremented.
vp
- the TPTP VerdictEvent to report as a verification point.vpStat
- the counter associated with this verification point.int getStatisticsLevel()
boolean wouldReportStatistics(int statisticsLevel)
Return true iff a statistics counter of the given statisticsLevel should be created. This takes into account the statistics Level and the whether or not the calling virtual user is being sampled.
statisticsLevel
- the statisticsLevel of the proposed counter
boolean wouldARM()
int getVirtualUserGUID()
|
IBM Rational Performance Tester SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |