![]() |
![]() |
|
|
Writing to the Log
The following sections describe how to write messages to the log in WebLogic Collaborate applications:
About the Log
WebLogic Collaborate applications can write messages (errors, warnings, and information) to a log file for subsequent examination. WebLogic Collaborate provides a Logging API that applications can use to write messages to the log.
Log Files
Logged messages are written to the following locations:
The wlc.log system log file is created automatically when a c-hub or c-enabler starts up. The size of this file is limited to 1MB. When the file size is exceeded, the file is renamed with a numeric suffix (such as wlc1.log) and a new empty file is created.
Logging API
The com.bea.eci.logging package contains the WebLogic Collaborate logging API, which consists of the classes described in the following table.
For detailed information about these classes, see the Javadoc on the WebLogic Collaborate documentation CD or in the classdocs subdirectory of your WebLogic Collaborate installation.
Severity Levels
The Log class defines the severity levels described in the following table.
Writing Messages to the Log
WebLogic Collaborate applications can write messages to the user log using the log method in the UserLog class. The log method has two versions: one version specifies the message text with an INFO severity level, and the other version specifies the message text and a particular severity level (FATAL, ERROR, or WARNING). In addition, applications have print stream access to the log via userlog.out.
Importing the Logging Package
To write to the log, WebLogic Collaborate applications must import the com.bea.eci.logging package, as shown in the following listing.
Listing 6-1 Importing the com.bea.eci.logging Package
import com.bea.eci.logging.*;
Writing a Log Message with an INFO Severity Level
To write a log message with an INFO severity level, an application can use the following version of the log method:
static void log(java.lang.String userMsg)
The following listing shows writing a log message with an INFO severity level:
Listing 6-2 Writing an INFO Message to the Log
private static void debug(String msg){
if (DEBUG)
UserLog.log("***Partner1Servlet: "+msg);
}
Writing a Message With a Specific Severity Level
To write a log message with a specific severity level, an application uses the following version of the log method:
static void log(int severity, java.lang.String userMsg)
The following listing shows writing a log message with a WARNING severity level:
Listing 6-3 Writing a WARNING Message to the Log
private static void debug(String msg){
if (DEBUG)
UserLog.log(log.WARNING, msg);
}
try {
}catch(Exception e){
debug("Partner1 exception errors");
e.printStackTrace(UserLog.out);
}
![]() |
![]() |
|
Copyright © 2001 BEA Systems, Inc. All rights reserved.
|