![]() |
![]() |
|
|
Writing to the Log
The following sections describe how to write messages to the B2B integration log:
About the Log
The B2B engine uses 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 b2b.log system log file is created automatically when WebLogic Integration 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 b2b1.log) and a new empty file is created.
Logging API
The com.bea.eci.logging package contains the Logging API, which consists of the classes described in the following table.
For detailed information about these classes, see the BEA WebLogic Integration Javadoc on the WebLogic Integration documentation CD or in the classdocs subdirectory of your WebLogic Integration installation.
Severity Levels
The Log class defines the severity levels described in the following table.
Table 1-2 Severity Levels Defined in Log Class
Writing Messages to the Log
WebLogic Integration applications can write messages to the 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 Integration 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.
|