IBM Rational Performance Tester SDK

com.ibm.rational.test.lt.kernel.services
Interface IPDLogManager


public interface IPDLogManager

The IPDLogManager interface logs messages to the problem determination log from custom code actions.

Most code needs to handle error conditions, anomalies in expected data, or other abstract conditions that would cause the need to report such a problem.

The IPDLogManager interface is the best interface to use for all actions, including all custom code, to report on these circumstances. Use this interface for conveying informational or status messages to display after the completion of a test.

This 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 for internal use only. Do not call or use them as they may have unpredictable results.

USING IPDLogManager FROM CUSTOM CODE (ICustomCode2)

Use getPDLogManager() in ITestExecutionServices to acquire an object that provides these methods.

To use the IPDLogManager 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?

After you have determined what the message is about, examine the constants defined in this class to choose the best fit. For simple log messages:

SEVERE

Log a severe message. These are messages that indicate that fidelity has been compromised by a problem.

WARNING

Log a warning message. Warning messages indicate that the run experienced an unexpected condition, but that it has recovered and is continuing execution.

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 make is whether the message level you are logging is of interest to the workbench (is anybody listening?).

Make a call to wouldLog(...) to determine if you need to send the message. For example:

     if (wouldLog(INFO))
         log(INFO, "Hello, World, I see you are interested");
 

NOTE: Making a call to wouldLog() before logging any information is a preferred practice as it improves performance when the logging levels are restrictive. Avoid creating a string that contains the output to be sent if the output is being filtered.

See ITestLogManager for information about logging messages and events to the TestLog (aka execution history) and IStatisticsManager for information about creating and reporting counters to the performance test results for graphing and reports.


Field Summary
static int ALL
          Logs messages at the highest (most verbose) log level.
static int CONFIG
          Logs message at the 'config' level.
static int FINE
          Logs debug messages at the 'fine' level (produces the least amount of debugging output).
static int FINER
          Logs debug messages at the 'finer' level (produces a medium amount of debugging output).
static int FINEST
          Logs debug messages at the 'finest' level (produces the most debugging output).
static int INFO
          Logs messages at the 'informational' level.
static int NONE
          Does not log the message.
static int SEVERE
          Logs messages at the 'severe' level (errors).
static int WARNING
          Logs messages at the 'warning' level.
 
Method Summary
 int getLevel()
          Gets the current active log level.
 void log(int logLevel, Object msg)
          Sends a message (conditionally) to the log.
 void log(int logLevel, Object msg, Throwable e)
          Sends a message with a stack trace (conditionally) to the log.
 void log(Object msg)
          Sends a message to the log if the calling virtual user is one of the virtual users that are being sampled.
 void log(Object msg, Throwable e)
          Sends a message with a stack trace to the log if the calling virtual user is one of the virtual users that are being sampled.
 boolean wouldLog(int logLevel)
          Returns true if a log message with the given logLevel will appear in a log.
 

Field Detail

ALL

static final int ALL
Logs messages at the highest (most verbose) log level.

Because this level produces a large volume of log messages, it is best not to log messages at this level unless you are sure you need this quantity of information.

Used for internal testing purposes only.

See Also:
IPDLogManager.FINE, IPDLogManager.FINER, IPDLogManager.FINEST, Constant Field Values

FINEST

static final int FINEST
Logs debug messages at the 'finest' level (produces the most debugging output).

Used for internal testing purposes only.

See Also:
IPDLogManager.FINE, IPDLogManager.FINER, Constant Field Values

FINER

static final int FINER
Logs debug messages at the 'finer' level (produces a medium amount of debugging output).

Used for internal testing purposes only.

See Also:
IPDLogManager.FINE, IPDLogManager.FINEST, Constant Field Values

FINE

static final int FINE
Logs debug messages at the 'fine' level (produces the least amount of debugging output).

Used for internal testing purposes only.

See Also:
IPDLogManager.FINER, IPDLogManager.FINEST, Constant Field Values

CONFIG

static final int CONFIG
Logs message at the 'config' level.

Output messages to this level if the data to be presented relates to the particular configuration of the kernel, the engine, or another subsystem.

Used for internal testing purposes only.

See Also:
Constant Field Values

INFO

static final int INFO
Logs messages at the 'informational' level.

Used by all kernel subsystems and by custom code developers, the 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 is required in response.

See Also:
IPDLogManager.WARNING, IPDLogManager.SEVERE, Constant Field Values

WARNING

static final int WARNING
Logs messages at the 'warning' level.

Used by all kernel subsystems and by custom code developers, the 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 is required in response.

See Also:
IPDLogManager.INFO, IPDLogManager.SEVERE, Constant Field Values

SEVERE

static final int SEVERE
Logs messages at the 'severe' level (errors).

Used by all kernel subsystems and by custom code developers, the 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 must terminated. Information should be logged that would indicate the course of action required in response.

See Also:
IPDLogManager.INFO, IPDLogManager.WARNING, Constant Field Values

NONE

static final int NONE
Does not log the message.

Used for internal testing purposes only.

See Also:
Constant Field Values
Method Detail

getLevel

int getLevel()
Gets the current active log level.

Returns:
The log level that is currently set.

wouldLog

boolean wouldLog(int logLevel)
Returns true if a log message with the given logLevel will appear in a log.

This method evaluates the log level and whether the calling virtual user is one of those for whom sampling is active.

Parameters:
logLevel - The logLevel of the proposed message.
Returns:
True if a message of the given logLevel will appear in the log. False otherwise.

log

void log(Object msg)
Sends a message to the log if the calling virtual user is one of the virtual users that are being sampled.

Equivalent to log(SEVERE, msg)

Parameters:
msg - The message to be logged.

log

void log(Object msg,
         Throwable e)
Sends a message with a stack trace to the log if the calling virtual user is one of the virtual users that are being sampled.

Equivalent to log(SEVERE, msg, e)

Parameters:
msg - The message to be logged.
e - The exception for which a stack trace is to be logged.

log

void log(int logLevel,
         Object msg)
Sends a message (conditionally) to the log.

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.

Parameters:
logLevel - The log level at which to send this message.
msg - The message to be logged.

log

void log(int logLevel,
         Object msg,
         Throwable e)
Sends a message with a stack trace (conditionally) to the log.

If the current log level is greater than or equal to the log level specified for the message, and the calling virtual user is being sampled, the message will be sent.

Parameters:
logLevel - The log level at which to send this message.
msg - The message to be logged.
e - The exception for which a stack trace is to be logged.

IBM Rational Performance Tester SDK

© Copyright IBM Corp. 2012. All rights reserved.