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