Sun Java System Instant Messaging 7 2006Q1 Administration Guide

Chapter 11 Managing Logging for Instant Messaging

Instant Messaging creates log files that record events, related status of various software components, system errors, and other aspects of the server, multiplexor, Calendar agent, and watchdog. By examining the log files, you can monitor many aspects of the server’s operation. In addition, you can collect logging data for Instant Messenger on demand. This section provides information about logging in the following topics:

For information on logging for the XMPP/HTTP Gateway, see Managing Logging for the XMPP/HTTP Gateway.

Instant Messaging Logging Overview

Instant Messaging provides two ways to generate log files; using log4j, or without log4j by specifying parameters in iim.conf. Log4j style logging is available for the server, Calendar agent, watchdog, and the XMPP/HTTP Gateway, but not the multiplexor.

For information on logging for the XMPP/HTTP Gateway, see Managing Logging for the XMPP/HTTP Gateway.


Note –

The iim.conf parameter-based logging mechanism may be deprecated in a future release. Use log4j wherever possible.


You can configure the level of logging for the Instant Messaging server, multiplexor, Calendar agent, watchdog, and XMPP/HTTP Gateway. In addition, using log4j, you can configure Instant Messaging to generate a separate log file for XMPP traffic only.

If you are not using log4j style logging, as part of regular system maintenance, you need to periodically review and trim the log files from occupying more disk space. The server does not perform this action.

For more information about log4j, see the Apache Logging Services website.

Instant Messaging Log File Location

You specify the location of the log files when you run the configure utility after installing Instant Messaging. Typically, log files are stored in im_runtime_base/log. See Instant Messaging Server Directory Structure for information on locating im_runtime_base.

If you are using log4j for log file generation in your deployment, the logger will also use the directory you specify during configuration as the base directory in which to store log4j logs.

Instant Messaging Component Logging Levels

The level or priority of maintaining the error log defines how detailed, or verbose, the log should be. A higher priority level implies less details as only events of high priority (high severity) are recorded in the log file. In contrast a lower priority level implies greater details as more events are recorded in the log file.

Regardless of whether you are using log4j or parameter-based logging, you can set the logging level separately for each component.

Table 11–1 describes the logging levels for the components. These logging levels are a subset of the levels defined by the UNIX syslog facility.

Table 11–1 Logging Levels for Instant Messaging Components

Level  

Description  

FATAL

This priority level records minimum logging details in the log file. A log record is added to the log file whenever a severe problem or critical condition occurs. If a FATAL problem occurs, the application might stop functioning. 

ERROR

A log record is added to the log file whenever a recoverable software error condition occurs or a network failure is detected. For example, when the server fails to connect to a client or to another server. 

WARNING

A log record is added to the log file whenever a user error is detected. For example, when the server cannot understand the communication sent by the client. 

INFO

A log record is added to the log file whenever a significant action takes place. For example, when an end user successfully logs in or logs out. 

DEBUG

The tasks are recorded in the log file. This information is useful for debugging purposes only. Each event with individual steps within each process or task are written to the log file, to help the end user identify the problems while debugging the application. 

When you select a particular logging level, events corresponding to that level and to all higher and less verbose levels are logged.

INFO is the default level for the server. ERROR is the default level for the multiplexor, Calendar agent, and watchdog log files.


Note –

If you are not using log4j, and you specify DEBUG as the logging level, your log files will occupy more disk space. Monitor and trim your log files to prevent them from occupying more disk space.


Managing Instant Messaging Logging Using Log4j

When you install Instant Messaging, a template file (log4j.conf.template) for the log4j configuration file is installed into the im_svr_base/lib directory. When you run the configure utility after installation, the template is used to create the log4j configuration file (log4j.conf) in the im_cfg_base directory. This configuration file is used to determine where to store log files generated by log4j, the logging level to use for various components, the output syntax, and to determine what log files to generate.

This section describes using the log4j logger to generate log files for Instant Messaging in the following sections:

The logging levels described in Instant Messaging Component Logging Levels are used by the log4j logger.

For more information about log4j, and instructions on configuring aspects of log files, such as size, number of backups, etc., see the Apache Logging Services website.

Instant Messaging Log4j Configuration File (log4j.conf) Location

You can change the location of the log4j configuration file, log4j.conf, by modifying the iim.log4j.config parameter in iim.conf. If you do not specify a value for this parameter, the logger will look in im_cfg_base. If the logger does not find the log4j configuration file in that directory, it uses the logging parameters in iim.conf to generate non-log4j style logs.

See Instant Messaging Server Directory Structure for information on locating im_cfg_base.

Instant Messaging Log4j Log File Syntax

The configure utility generates the log4j configuration file (log4j.conf) based on the content of the log4j configuration file template (log4j.conf.template). Example 11–1 shows the log4j template. In this template:


Example 11–1 Log4j Template File


log4j.logger.xmppd=INFO, A1
# DEFAULT TO RollingFileAppender
log4j.appender.A1=org.apache.log4j.RollingFileAppender
log4j.appender.A1.file=${logdir}/xmppd.log
log4j.appender.A1.append=true
log4j.appender.A1.maxBackupIndex=7
log4j.appender.A1.maxFileSize=5mb
# More example appenders..
# Straight to console..
# log4j.appender.A1=org.apache.log4j.ConsoleAppender
# log4j.appender.A1.ImmediateFlush=true
# Rollover at midnight..
# log4j.appender.A1=org.apache.log4j.DailyRollingFileAppender
# log4j.appender.A1.DatePattern='.'yyyy-MM-dd
# log4j.appender.A1.file=${logdir}/xmppd.log
# log4j.appender.A1.ImmediateFlush=true
# log4j.appender.A1.append=true
# Send to SMTP..
# log4j.appender.A1=org.apache.log4j.SMTPAppender

# PATTERN LAYOUT AND OPTIONS
# DEFAULT TO PatternLayout
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
# For full dates..
log4j.appender.A1.layout.ConversionPattern=[%d{DATE}] %-5p %c [%t] %m%n
# IM traditional output format..
#log4j.appender.A1.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p %c [%t] %m%n
# More example layouts
# XMLLayout for chainsaw consumption
# log4j.appender.A1.layout=org.apache.log4j.xml.XMLLayout
# TTCCLayout for NDC information

# log4j.appender.A1.layout=org.apache.log4j.xml.TTCCLayout
# log4j.appender.A1.layout.DateFormat=ISO8601
# log4j.appender.A1.layout.TimeZoneID=GMT-8:00
# log4j.appender.A1.layout.CategoryPrefixing=false
# log4j.appender.A1.layout.ThreadPrinting=false
# log4j.appender.A1.layout.ContextPrinting=false

# Now we list logger/appender/layout for the other default loggers, but
# only the defaults..
log4j.logger.iim_wd=ERROR, A2
log4j.appender.A2=org.apache.log4j.RollingFileAppender
log4j.appender.A2.file=${logdir}/iim_wd.log
log4j.appender.A2.append=true
log4j.appender.A2.maxBackupIndex=7
log4j.appender.A2.maxFileSize=5mb
log4j.appender.A2.layout=org.apache.log4j.PatternLayout
log4j.appender.A2.layout.ConversionPattern=[%d{DATE}] %-5p %c [%t] %m%n

# For separate xmpp traffic log, disabled by default.
log4j.logger.xmppd.xfer=DEBUG, A3
log4j.appender.A3=org.apache.log4j.varia.NullAppender
# Select next block instead of previous line to enable separate transfer log
# log4j.appender.A3=org.apache.log4j.RollingFileAppender
# log4j.appender.A3.file=${logdir}/xfer.log
# log4j.appender.A3.append=true
# log4j.appender.A3.maxBackupIndex=7
# log4j.appender.A3.maxFileSize=5mb
# log4j.appender.A3.layout=org.apache.log4j.PatternLayout
# # Note, simpler default output than above 3 loggers:
# log4j.appender.A3.layout.ConversionPattern=[%d{DATE}] %-5p %c [%t] %m%n

log4j.logger.agent-calendar=ERROR, A4
log4j.appender.A4=org.apache.log4j.RollingFileAppender
log4j.appender.A4.file=${logdir}/agent-calendar.log
log4j.appender.A4.append=true
log4j.appender.A4.maxBackupIndex=7
log4j.appender.A4.maxFileSize=5mb
log4j.appender.A4.layout=org.apache.log4j.PatternLayout
log4j.appender.A4.layout.ConversionPattern=[%d{DATE}] %-5p %c [%t] %m%n

log4j.logger.net.outer_planes.jso.BasicStream=OFF, A5
log4j.appender.A5=org.apache.log4j.RollingFileAppender
log4j.appender.A5.file=${logdir}/jso.log
log4j.appender.A5.append=true
log4j.appender.A5.maxBackupIndex=7
log4j.appender.A5.maxFileSize=5mb
log4j.appender.A5.layout=org.apache.log4j.PatternLayout
log4j.appender.A5.layout.ConversionPattern=[%d{DATE}] %-5p %c [%t] %m%n

log4j.logger.genredirect=INFO, A6
log4j.appender.A6=org.apache.log4j.RollingFileAppender
log4j.appender.A6.file=${logdir}/genredirect.log
log4j.appender.A6.append=true
log4j.appender.A6.maxBackupIndex=7
log4j.appender.A6.maxFileSize=5mb
log4j.appender.A6.layout=org.apache.log4j.PatternLayout
log4j.appender.A6.layout.ConversionPattern=[%d{DATE}] %-5p %c [%t] %m%n

Log4j Log Levels for Instant Messaging Components

The log4j logger uses the same logging levels described for the iim.conf parameter-based logging mechanism in Instant Messaging Component Logging Levels.

ProcedureTo Specify the Location of the Log4j Configuration File (Log4j.conf)

Steps
  1. Open iim.conf.

    See iim.conf File Location for information on locating this file.

  2. Set the iim.log4j.config parameter to the path in which you want the logger to look for log4j.conf.

    For example, on Solaris:


    iim.log4j.config=/etc/opt/SUNWiim/default/config/log4j.conf
    

    On Linux:


    iim.log4j.config=/etc/opt/sun/im/default/config/log4j.conf
    
  3. Save and close iim.conf.

  4. Refresh the server.


    imadmin refresh
    

    Caution – Caution –

    Do not use the imadmin start, imadmin stop, or imadmin refresh commands in an HA environment with Sun Cluster. Instead, use the Sun Cluster administrative utilities.


ProcedureTo Enable or Disable Log4j Logging for an Instant Messaging Component

By default, log4j logging is used for all components for which logging information is generated.

Steps
  1. To disable log4j logging, set the logging level for the component to OFF in both log4j.conf and log4j.conf.template.

    See To Set Log4j Log Levels for Instant Messaging for more information.

  2. To enable log4j logging, set the logging level for the component to any logging level other than OFF in both log4j.conf and log4j.conf.template.

ProcedureTo Set Log4j Log Levels for Instant Messaging

You can set log levels by modifying either the template or the log configuration file. However, if you only modify the configuration file, any changes you make will be overwritten the next time you run configure. To prevent this, you should make your changes to both the configuration file and the template.

Steps
  1. Open log4j.conf.template.

    By default, this file is stored in the following location:


    im_svr_base/lib
  2. For each component, specify the logging level you want to use.

    For example, to set the log level for the server:


    log4j.logger.xmppd=log_level
    

    Where log_level is one of FATAL, ERROR, WARNING, INFO, or DEBUG.

    See Table 11–1 for detailed information on each of these logging levels.

  3. Save and close log4j.conf.template.

  4. Repeat the procedure for the configuration file log4j.conf.

ProcedureTo Specify the Maximum Log4j Log File Size for Instant Messaging Components

You can set log levels by modifying either the template or the log configuration file. However, if you only modify the configuration file, any changes you make will be overwritten the next time you run configure. To prevent this, you should make your changes to both the configuration file and the template.

Steps
  1. Open log4j.conf.template.

    By default, this file is stored in the following location:


    im_svr_base/lib
  2. For each component, specify the maximum size for the component's log file.

    For example, to set the size for the server log file:


    log4j.appender.A1.maxFileSize=max_logfile_size
    

    Where A1 is the default appender ID for the server, max_logfile_size is in MB, for example 5MB.

  3. Repeat the procedure for the configuration file log4j.conf.

Configuring Logging for Instant Messaging Components Using iim.conf Parameters

If you are not using log4j to generate log files, you need to set a configuration parameter specific to each component for which you want Instant Messaging to generate logging information. This method is referred to as parameter-based logging for Instant Messaging.


Note –

This iim.conf parameter-based logging mechanism may be deprecated in a future release. Use log4j when possible.


Table 11–2 provides the name of the log files and the configuration parameter in iim.conf used to set the logging level for each Instant Messaging component log file.

Table 11–2 Log File Names and Logging Level Configuration Parameters for Instant Messaging Components

Component  

Log File Name  

Logging Level Configuration Parameter  

Server 

xmppd.log

iim.log.iim_server.severity

Multiplexor 

mux.log

iim.log.iim_mux.severity

Calendar agent 

agent-calendar.log

iim.log.agent-calendar.severity

Watchdog 

iim_wd.log

iim.log.iim_wd.severity

The configuration parameters can have the following values:

See Instant Messaging Component Logging Levels for information on the details logged for each logging level.

In addition, logging configuration in deployments with Sun JavaTM System Access Manager is determined by the com.iplanet.services.debug.level property. You set this property in the AMConfig.properties file on the Sun JavaTM System Access Manager host. By default, this file is installed in the following location:

AM_svr_base/lib/AMConfig.properties

Where AM_svr_base is the directory in which you installed Access Manager.

This property can contain the following values:

By default, the Sun JavaTM System Portal Server desktop log file (desktop.debug) and archive log files (IMArchiveSearch.log and IMArchiveSubmit.log) are stored in the following locations:

ProcedureTo Set Log Levels for Instant Messaging Components Using iim.conf Parameters

Step

    Modify logging parameters in iim.conf.

    See Table 11–2 for a list of the log files and the associated parameter you need to set for each component.

    See iim.conf File Syntax for instructions on locating and modifying iim.conf. For more information on the watchdog, see Managing the Watchdog Process. For more information on the Calendar agent, see Chapter 14, Using Calendar Pop-up Reminders.

Administering Instant Messaging Client Logging

By default, client data is not logged. You may be asked to collect client data during a support call. In this situation, you will need to enable logging before you can view client log data.

ProcedureTo Enable Client Logging for Instant Messaging

Steps
  1. Enable the logging feature in either the Java Web Start Application Manager or the Java Plug-In Control Panel as appropriate.

    If the client uses the Java plug-in with an earlier version of the JDK, run the Java Plug-In Control Panel. See the online help for the Java Plug-In Control Panel for instructions on enabling logging.

    If the client uses Java Web Start or uses the plug-in with JDK 5.0, run the Java Web Start Application Manager, then:

    1. Select File->Preferences.

      The Preferences dialog box appears.

    2. On the Advanced tab, select the Log Output checkbox and enter a Log File Name.

    3. Click OK.

  2. Open im.jnlp in a text editor.

  3. Search for the line:


    <application-desc main-class="com.iplanet.im.client.iIM">
  4. Add the following argument to the end of the section:


    <argument>debug=true</argument>
    
  5. Save and close the im.jnlp file.

  6. If you are using Sun JavaTM System Access Manager or Sun JavaTM System Web Server, redeploy the resource files as described in Redeploying Resource Files.

  7. Relaunch Instant Messenger.