Logger
This class is a helper class to implement logging functions for other sample classes.
For more information, see the comments in the sample source. The samples are supplied in the Developer samples section of the IBM® FileNet P8 Platform publication library.
See also Running the API Samples.
Methods
General descriptions of the Logger methods follow:
Logger()
The calling program passes the name of the log file to open when it invokes the Logger constructor. The constructor creates an instance of a PrintWriter object and ends by displaying the name of the output file.
displayStepElementInfo() and displayWorkObjectInfo()
The logger object displays descriptive information for Step Element or Work Object objects by using Logger.displayStepElementInfo(object) or Logger.displayWorkElementInfo(object). In each method, the logger assembles display lines by using VWStepElement.getParameterNames and VWStepElement.getParameterValue for step elements and VWWorkObject.getFieldNames and VWWorkObject.getFieldValue for work objects.
log(Exception ex)
Prints a stack trace to the log file.
log(String text, Object arg1)
Writes the specified string to the log file, in a manner that depends on the Object argument:
- If the Object argument is NULL, Logger.log(String text) is invoked
- If the Object argument is a string, the two string arguments are concatenated and Logger.log(String text) is invoked with the concatenated string as the argument.
- If the Object argument is an object or array of objects, the following methods are called: StringBuffer() is called to convert the objects to a string, and Logger.log(String text) is called with the resulting string as the argument.
log(String text) and logAndDisplay(String text)
Logger.log(String text) writes the specified string to the log file. Logger.logAndDisplay(String text) writes the string to both the log file and stdout.