Logging messages with the Java Integration stage (DataStage)
You can use the Logger class (com.ibm.is.cc.javastage.api.Logger) to log runtime and design-time messages for your job.
At run time, error, warning, and informational messages are written to the job log. For example,
your code can write informational messages by calling Logger.information()
. The
runtime code of the Java™ Integration stage connector also logs
messages to the job log.
The design-time messages are stored in the Connector Access Service log, which you can view in
the InfoSphere® Information Server Web console. For
example, your code can debug messages by calling Logger.debug()
. The design-time
code of the Java Integration stage also logs messages to the
Connector Access Service log.
debug(int messageNumber, String message)
debug(String message)
fatal(String message)
getComponentID()
information(int messageNumber, String message)
information(String message)
isDebugEnabled ()
setComponentID(String compID)
warning(int messageNumber, String message)
warning(String message)
For more information about the Logger class, see the Javadoc for the Java Integration stage API.
Message ID format for the Logger class
The Logger class (com.ibm.is.cc.javastage.api.Logger) logs messages in the
IIS-categoryID-componentID-messageNumber
format.
IIS is the prefix for InfoSphere Information Server. categoryID is the category of the component that produces the message. CONN is the categoryID for connectors, including the Java Integration stage. componentID is the component throwing the message. messageNumber is a positive integer for the message.
The following table contains a list of event types and the predefined message IDs in the Java Integration stage.
Method | Event type | Message ID |
---|---|---|
Logger.debug(String message) | Informational | IIS-CONN-JAVA-00011 |
Logger.information(String message) | Informational | IIS-CONN-JAVA-00012 |
Logger.warning(String message) | Warning | IIS-CONN-JAVA-00013 |
Logger.fatal(String message) | Fatal | IIS-CONN-JAVA-00015 |
Logging messages with custom IDs
If the Logger class is invoked at run time, the messages are logged to the Director client log. If the Logger class is invoked at design time, the messages are logged to the Connector Access Service log. At run time, you can log a message with the message ID that is defined in the Java Integration stage or log a message with a custom message ID that is defined in your Java code.
You can use the following methods of the Logger class in your Java code to log messages with custom message IDs to the Director client log:
setComponentID(String compID)
debug(int messageNumber, String message)
information(int messageNumber, String message)
warning(int messageNumber, String message)
For more information about the Logger class, see the Javadoc information for the Java Integration stage API.
Logger.setComponentID("MYCONN");
Logger.information(123, "Job completed successfully");
Logging debug messages
You can use Java code to log debug messages when the JAVASTAGE_API_DEBUG environment variable is set to 1.
Logger
class in your Java code to log debug messages: debug(String message)
debug(int messageNumber, String message)
isDebugEnabled()
setComponentID(String compID)
debug test 001
debug test 002
…
debug test 999
if (Logger.isDebugEnabled())
{
Logger.debug("debug test 001");
Logger.debug("debug test 002");
…
Logger.debug("debug test 999");
}
The Logger.isDebugEnabled()
method returns true if the
JAVASTAGE_API_DEBUG environment variable is set to 1. To avoid calling the
Logger.debug
method unnecessarily, ensure that the
Logger.isDebugEnabled()
method returns true.