![]() |
![]() |
|
|
Writing to the Log
The following sections describe how to write messages to the log in BEA WebLogic Collaborate applications:
About the Log
WebLogic Collaborate applications use the Logging API to write error, warning, and information messages to a log file.
Log Files
Logged messages are written to the following locations:
The wlc.log system log file is created automatically when WebLogic Collaborate starts up. The size of this file is limited to 1MB. When this maximum is exceeded, the file is renamed with a numeric label (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 BEA 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 records a message in the user log and does one of the following:
In addition, applications can access the print stream to the user log using 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 1-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)
In the preceding line, userMsg is the message text to be logged.
When you use this version of the log method, the severity in the log defaults to INFO. The following listing shows how to write a log message with an INFO severity level.
Listing 1-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)
In the preceding line:
The following listing shows how to write a log message with a WARNING severity level.
Listing 1-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.
|