System event logging
The system event logging facility of WebSphere Portal enables the recording of information about the operation of the portal. Event logs provide portal administrators with information on important or abnormal events, especially errors, that occur during the operation of the portal. In addition, event logs gather debugging information that helps portal support to resolve problems with the operation of the portal.
WebSphere Portal provides two types of logging: logging of messages, and logging of debugging messages called traces.
- Message logging
- Trace logging
- Changing the log file name and location
- Changing the language used in the log file
- Set temporary traces
- Set traces for an extended time
- Logging using WebSphere Application Server
- Reference: Log file format
Message logging
WebSphere Portal provides the logging of messages that report errors and status information. This type of logging is always enabled.
The following types of messages are provided:
- Informational
A condition that is worth noting that does not require the user to perform an action.- Warning
An abnormal condition that has been detected, where the user may have to take action, and where WebSphere Portal code is able to handle the condition without failing.- Error
A serious failure in the execution of the application that requires further action.
Trace logging
WebSphere Portal provides the logging of debugging messages called traces. These traces are useful for fixing problems. However, to save system resources, they are switched off by default.
Traces can be set for different durations:
- Temporary
Traces can be set for a temporary period, that is, for the duration of the current session only, by using the appropriate administration portlet.- Extended
Traces can be set for a longer period of time, that is, for more than one session, by manually switching them on in the log configuration file of WebSphere Portal, wp_root/shared/app/config/log.properties.
Changing the log file name and location
WebSphere Portal, by default, creates a single log file, wp_root/log/wps_date.log, where date is the date on which the log is created. The date information is automatically inserted in the log file name. This file is updated when an error occurs or if trace logs are created.
You can change the location and the name of this file by changing the configuration key logFileName in the log configuration file (wp_root/shared/app/config/log.properties).
The specified log file name can contain one of two tokens that are automatically replaced with the corresponding values when starting WebSphere Portal:
- $APPSERVER_NAME: The name of the application server. Use this token for vertical clusters to enforce that the different application servers write into different files or directories if they share the same file system.
- $CREATE_TIME: The date and time at which the file was created.
You can specify the location of the log file either using a relative path or an absolute path.
- A value such as logfilename=log/$APPSERVER_NAME/Portal_$CREATE_TIME.log causes the log file to be created relative to the directory where WebSphere Portal is installed. In this case, the wp_root/log/PORTAL1/Portal_2003.05.16-13.36.14.log file is created on a machine that is named PORTAL1. The value log/wps_$CREATE_TIME.log is the default location for the log file.
- A value such as logfilename=c:/temp/wps_$CREATE_TIME.log causes the log file to be created in the absolute location specified.
If you change the location of the log file, restart WebSphere Portal in order to use the new location.
Changing the language used in the log file
By default, information in the log file is written in the language that was used for the WebSphere Portal installation. However, because WebSphere Portal supports a number of languages, you can choose to have the log file information written in a language other than that used during installation.
To change the language used for the log file, edit the wp_root/shared/app/config/log.properties file, and add the following line:
locale=xxwhere xx is the two-letter abbreviation for the locale. For a list of the locale abbreviations used with WebSphere Portal, refer to the language directory list in Directory structure.For example, to have log information generated in English, you would add the following line:
locale=en
Set temporary traces
To set traces on for the current session only, use the Enable Tracing portlet in Administration.
To set traces, you have to type the desired trace logger strings. You cannot select the trace loggers as described in the portlet help. For a list of trace logger strings refer to Use logs.
Set traces for an extended time
To set traces for more than one session, the log configuration key traceString is used. The value is a regular expression-like syntax that specifies one or more Java classes of the WebSphere Portal code for which tracing is enabled.
Syntax of the key traceString
The key traceString has the following syntax:
TraceString := <ClassString>(:<ClassString>)* ClassString := <ClassName>=<type>=<state>(,<type>=<state>)* ClassName := a java String state := [enabled|disabled] type := [all|low|medium|high]ClassName is used to identify the class (or set of classes) to which the specified change applies. This ClassName may either be an exact name which uniquely identifies a single class, or it may identify a point in the class hierarchy by using the "*" wild card character.
For example, if classes 'a.b.c.d' and 'a.b.c.e' are available, then the name 'a.b.c.d' applies to just one class and the name 'a.b.c.*' applies to both. The following are examples of valid trace strings:
a.b.c.d=all=enabled a.b.c.d=low=enabled,medium=disabled a.b.*=low=enabled:a.b.c.d=low=enabled,medium=enabled:a.b.c.e=low=disabledFor traceString values to use for determining problems in portal components, refer to the Information Center topic Using logs.
Logging using WebSphere Application Server
WebSphere Portal supports the redirection of its trace and message logging to the logging facility of WebSphere Application Server. This redirection is disabled by default and can be enabled by setting the log configuration key useAppServerLog to true. In this situation, WebSphere Portal no longer creates its own log file, and writes all trace and message logs to the log files of WebSphere Application Server (usually to the files SystemOut.log and trace.log). For more information on configuring these log files, refer to the Information Center of WebSphere Application Server.
Reference: Log file format
If the logs are written to the log file of WebSphere Portal and not redirected to the logging facility WebSphere Application Server, the log file consists of a sequence log records that are separated by blank lines.
The log records have the following format:
timestamp classification classname method
messagecode: logmessagewhere:
- timestamp is the time (to the millisecond) when the log record was created.
- classification is one of the following letters:
- E for error messages
- W for warning messages
- I for informational messages
- l for traces (low details)
- m for traces (medium details)
- h for traces (high details)
- classname is the Java class containing the code that triggered the log event.
- method is the name of the Java method containing the code that triggered the log event.
- messagecode is a unique identifier for this message, to uniquely identify the specific message and refer to it when consulting documentation or portal support. The message code is only available for error, warning, or informational messages, and not for traces. It consists of:
- a four-character identifier for the portal component that defines the message.
- a four-digit number identifying the message in the component.
- a one-letter classification code, which can be E, W or I , as defined above.
- logmessage is the actual log message describing the logged event. Error, warning, and informational messages are translated into the system locale for the portal. Trace messages are not translated.
Notes:
- Traces are written only if the specific tracing facility is enabled; all other messages are written unconditionally.
- The system locale for the portal is part of the general internationalization features of WebSphere Portal and can be configured via LocalizerService. For more information see the Information Center topic Portal configuration.
The following is an example of a log record:
2003.05.16 13:36:14.449 W com.ibm.wps.services.datastore.DataStoreServiceImpl init DSTO0063W: The transaction isolation level is not set to READ_COMMITTED.
The current value is TRANSACTION_REPEATABLE_READ.
See also
- Portal configuration
- Administer your portal
- Use logs.
- Designing your portal
- Developing portlets
- Troubleshooting
- Directory structure