BEA Logo BEA Collaborate Release 2.0

  BEA Home  |  Events  |  Solutions  |  Partners  |  Products  |  Services  |  Download  |  Developer Center  |  WebSUPPORT

 

   Collaborate Documentation   |   Logging   |   Previous Topic   |   Next Topic   |   Contents   |   Index

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.

Table 1-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 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.

Table 1-2 Severity Levels Defined in Log Class

Level

Severity

Indicates an occurrence of . . .

1

FATAL

A fatal error; a system component failed abnormally due to the exception that was detected.

2

ERROR

A critical error; system stability is affected.

3

WARNING

A minor exception; normal operation or system stability may not be affected.

4

INFO

No exception or failure; indicates only a message reporting normal operations, not exception conditions. An example of such a message is logging the successful startup of WebLogic Collaborate.


 

 


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

 

back to top previous page