Sun logo      Previous      Contents      Next     

Sun Java System Application Server Platform Edition 8.1 2005Q1 Administration Guide

Chapter 15
Configuring Logging

This chapter briefly describes how to use the Admin Console to configure logging and view the server log. It contains the following sections:


About Logging

Log Records

The Application Server uses the Java 2 platform Logging API specified in JSR 047. Application Server logging messages are recorded in the server log, normally found at domain_root_dir/domain_dir/logs/server.log.

The domain_root_dir/domain_dir/logs/ directory contains two other kinds of logs in addition to the server log. In the access subdirectory are the HTTP Service access logs, and in the tx subdirectory are the Transaction Service logs. For information about these logs, see "Configuring the HTTP Service Access Log" and "Configuring Transactions".

The components of the Application Server generate logging output. Application components can also generate logging output.

Application components may use the Apache Commons Logging Library to log messages. The platform standard JSR 047 API, however, is recommended for better log configuration.

Log records follow a uniform format:

[#|yyyy-mm-ddThh:mm:ss.SSS-Z|Log Level|ProductName_Version|LoggerName|Key Value Pairs|Message|#]

For example:

[#|2004-10-21T13:25:53.852-0400|INFO|sun-appserver-pe8.1|javax.enterprise. system.core|_ThreadID=13;|CORE5004: Resource Deployed: [cr:jms/DurableConnectionFactory].|#]

In this example,

The log record format might be changed or enhanced in future releases.

The Logger Namespace Hierarchy

The Application Server provides a logger for each of its modules. The following table lists the names of the modules and the namespace for each logger in alphabetical order, as they appear on the Log Levels page of the Admin Console (see "Configuring Log Levels"). The last three modules in the table do not appear on the Log Levels page.

Table 15-1  Application Server Logger Namespaces 

Module Name

Namespace

Admin

javax.enterprise.system.tools.admin

Classloader

javax.enterprise.system.core.classloading

CMP

javax.enterprise.system.container.cmp

Configuration

javax.enterprise.system.core.config

Connector

javax.enterprise.resource.resourceadapter

CORBA

javax.enterprise.resource.corba

Deployment

javax.enterprise.system.tools.deployment

EJB Container

javax.enterprise.system.container.ejb

JavaMail

javax.enterprise.resource.javamail

JAXR

javax.enterprise.resource.webservices.registry

JAX-RPC

javax.enterprise.resource.webservices.rpc

JDO

javax.enterprise.resource.jdo

JMS

javax.enterprise.resource.jms

JTA

javax.enterprise.resource.jta

JTS

javax.enterprise.system.core.transaction

MDB Container

javax.enterprise.system.container.ejb.mdb

Naming

javax.enterprise.system.core.naming

Node Agent (Enterprise Edition only)

javax.ee.enterprise.system.nodeagent

Root

javax.enterprise

SAAJ

javax.enterprise.resource.webservices.saaj

Security

javax.enterprise.system.core.security

Server

javax.enterprise.system

Synchronization (Enterprise Edition only)

javax.ee.enterprise.system.tools.synchronization

Util

javax.enterprise.system.util

Verifier

javax.enterprise.system.tools.verifier

Web Container

javax.enterprise.system.container.web

Core

javax.enterprise.system.core

System Output (System.out.println)

javax.enterprise.system.stream.out

System Error (System.err.println)

javax.enterprise.system.stream.err


Admin Console Tasks for Logging

Configuring General Logging Settings

  1. In the tree component, select the Application Server node.
  2. Click the Logging tab.
  3. On the Logging Settings page, use the following fields to customize logging:
    • Log File: To specify an alternative name or location for the server log file, type the new path name in the text field. By default, the location is domain_root_dir/domain_dir/logs/server.log.
    • Alarms: To route SEVERE and WARNING messages through the JMX framework, select the Enabled checkbox.
    • Write to System Log: On Solaris and Linux systems only, to send logging output to the syslog facility in addition to the server log, select the Enabled checkbox.
    • Log Handler: To send logs to a destination other than server.log or syslog, you can plug in a custom log handler. The custom handler must extend the class java.util.logging.Handler (a JSR 047 compliant API). Type the absolute class name of the handler in the Log Handler field. Also put the handler class in the Application Server classpath so that the handler is installed during server startup. The log records from the custom handler will have the format described in "Log Records".
    • Log Filter: To filter log records that are sent to destinations such as server.log, syslog, or a destination specified by a custom log handler, you can plug in a custom log filter. The custom filter must implement the interface java.util.logging.Filter. Type the absolute class name of the filter in the Log Filter field. Also put the filter class in the Application Server classpath so that the filter is installed during server startup.
    • File Rotation Limit: When the server log reaches the specified size in bytes, create a new, empty file named server.log and rename the old file server.log_date, where date is the date and time when the file was rotated. The default value is 2 megabytes. The minimum value for the limit is 500 kilobytes; if you specify a lower value, the file rotates when it reaches 500 Kbytes. To turn off log file rotation, set the value to 0.
    • File Rotation Time Limit: Rotate the server log after the specified number of minutes is reached. The default value is zero, which means that the file is rotated when it reaches the size specified in the File Rotation Limit field. If you specify one or more minutes, the time limit takes precedence over the size limit.
  4. Click Save to save changes. Click View Log Files to view the server log.
  5. Stop and restart the Application Server.

Configuring Log Levels

  1. In the tree component, select the Application Server node.
  2. Click the Logging tab.
  3. On the Logging Settings page, click the Log Levels tab.
  4. On the Module Log Levels page, choose a new value from the drop-down list opposite the module or modules whose log level is to be changed. The default level is INFO, meaning that messages at that level or higher (WARNING, SEVERE) appear in the log. Choose any of the following values (listed from highest to lowest):
    • SEVERE
    • WARNING
    • INFO
    • CONFIG
    • FINE
    • FINER
    • FINEST
    • OFF
  5. Use the Additional Properties area to configure log levels for any application loggers. The property name is the logger namespace, and the value is one of the eight possible levels. For example, the property name could be samples.logging.simple.servlet, and the value could be FINE.
  6. Also use this area to change the log level for a submodule, such as the transport submodule of the CORBA module:

    javax.enterprise.resource.corba.ORBId.transport
  7. Click Save to save the changes, or click Load Defaults to restore the default values.

Calls to System.out.println are logged at the INFO level using the logger name javax.enterprise.system.stream.out. Calls to System.err.println are logged at the WARNING level using the logger name javax.enterprise.system.stream.err. To turn off the logs from these sources, specify the logger name with the value OFF in the Additional Properties area.

Changes to the Log Level settings take effect immediately. They are also saved in the domain.xml file for use when the server restarts.

Viewing the Server Log

  1. In the tree component, select the Application Server node.
  2. Click the Logging tab.
  3. On the Logging Settings page, click View Log Files.

Use the Search Criteria area to customize and filter the log viewer. Use the basic fields as follows:

The most recent 40 entries in the server log appear, with the settings specified on the Logging Settings and Log Levels pages.

Click the triangle next to the Timestamp header to sort the messages so that the most recent one appears last.

To view a formatted version of any message, click the link marked

(details)

A window labeled Log Entry Detail appears, with a formatted version of the message.

At the end of the list of entries, click the buttons to view earlier or later entries in the log file.

Click Advanced Search in the Search Criteria area to make additional refinements to the log viewer. Use the Advanced Options fields as follows:

Click Basic Search to hide the Advanced Options area.



Previous      Contents      Next     


Copyright 2004-2005 Sun Microsystems, Inc. All rights reserved.