All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.as400.data.PcmlMessageLog

java.lang.Object
   |
   +----com.ibm.as400.data.PcmlMessageLog

public class PcmlMessageLog
extends Object
Provides control over logging and tracing activity within this package. PcmlMessageLog can be used to redirect error logging to a specific log file or OutputStream. It is also used to suppress the low level information/error messages normally written to the console.


Method Index

 o getLogFileName()
Returns the log file name.
 o getLogStream()
Returns the log stream.
 o isTraceEnabled()
Determines whether low level trace messages will be written to the console.
 o logError(Object)
Logs an error string to the current logging destination.
 o logError(Object, Throwable)
Logs an error string and a stack trace to the current logging destination.
 o printStackTrace(Throwable)
Logs a stack trace to the current logging destination.
 o setLogFileName(String)
Sets the log file name.
 o setLogStream(OutputStream)
Sets the log stream.
 o setTraceEnabled(boolean)
Controls whether low level trace messages will be written to the console.
 o traceErr(Object)
Writes data to System.err if low level tracing is enabled.
 o traceOut(Object)
Writes data to System.out if low level tracing is enabled.

Methods

 o setLogFileName
 public static void setLogFileName(String fileName) throws IOException
Sets the log file name. If the file exists, error data is appended to it. If the file does not exist, it is created.

Parameters:
fileName - the log file name. If null, output goes to System.err.
Throws: IOException
if the file cannot be accessed
See Also:
getLogFileName
 o getLogFileName
 public static String getLogFileName()
Returns the log file name. Returns null if errors are being logged to System.err, or if an OutputStream was specified on a call to setLogStream.

Returns:
the log file name
See Also:
setLogFileName, setLogStream
 o setLogStream
 public static void setLogStream(OutputStream stream)
Sets the log stream. This method allows applications to redirect errors generated by this package to the same OutputStream used by the application itself for logging errors.

Parameters:
stream - the OutputStream to which error data should be sent. If null, output goes to System.err.
See Also:
getLogStream
 o getLogStream
 public static OutputStream getLogStream()
Returns the log stream. This method is guaranteed to return a valid non-null OutputStream.

Returns:
the OutputStream to which error data is being sent
See Also:
setLogStream
 o logError
 public static void logError(Object errorData)
Logs an error string to the current logging destination. The string will be prepended with a header containing a date and timestamp if logging has been redirected to a destination other than System.err.

Parameters:
errorData - the data to be logged
 o logError
 public static void logError(Object errorData,
                             Throwable t)
Logs an error string and a stack trace to the current logging destination. The string will be prepended with a header containing a date and timestamp if logging has been redirected to a destination other than System.err.

Parameters:
errorData - the data to be logged
throwable - the Throwable which will be used to obtain the stack trace
 o printStackTrace
 public static void printStackTrace(Throwable t)
Logs a stack trace to the current logging destination.

Parameters:
throwable - the Throwable which will be used to obtain the stack trace
 o setTraceEnabled
 public static void setTraceEnabled(boolean enabled)
Controls whether low level trace messages will be written to the console. The default value is true.

Parameters:
enabled - If true, allows the messages; otherwise, suppresses the messages.
See Also:
isTraceEnabled
 o isTraceEnabled
 public static boolean isTraceEnabled()
Determines whether low level trace messages will be written to the console. The default value is true.

Returns:
true if the messages are allowed; false otherwise.
See Also:
setTraceEnabled
 o traceOut
 public static void traceOut(Object data)
Writes data to System.out if low level tracing is enabled.

Parameters:
data - the data to be logged
See Also:
traceErr
 o traceErr
 public static void traceErr(Object data)
Writes data to System.err if low level tracing is enabled.

Parameters:
data - the data to be logged
See Also:
traceOut

All Packages  Class Hierarchy  This Package  Previous  Next  Index