BEA Logo BEA WebLogic Collaborate Release 1.0

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy

 

   WebLogic Collaborate Doc Home   |   Developer Guide   |   Previous Topic   |   Next Topic   |   Contents   |   Index

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.

Table 6-1 Logging API

Name

Description

Log

Defines severity levels for log messages.

UserLog

Represents a user log. Provides access to the log for users. The user log is defined as a User log output stream (with a <user> tag) in the system log.

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.

Table 6-2 Severity Levels Defined in Log Class

Level

Severity

Description

1

FATAL

Fatal error has occurred. A system component failed abnormally due to the exception that was detected.

2

ERROR

User level error has occurred. A critical error occurred that impacts system stability.

3

WARNING

Warning message. A minor exception occurred that does not impact system stability.

4

INFO

Informational message. Informational only. Not used in exception conditions. An example would be logging the successful startup of the c-hub.

 


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);
}