Sun Java System Application Server Enterprise Edition 8.2 Administration Guide

Chapter 15 Configuring Logging

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

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-dir/logs/server.log.

The 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, consult the Administration Console online help.

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-e8.1|javax.enterprise.
system.core|_ThreadID=13;|CORE5004: Resource Deployed: 
[cr:jms/DurableConnectionFactory].|#]

In this example,

You can use the com.sun.enterprise.server.logging.max_history_files system property to limit the number of rotated log files for both access logging and the server log. The property specifies the maximum number of access log files to keep, starting with the most recent ones.

In the Admin Console, access the config/server that this system property needs to be set for. On the command line, use the create-jvm-option command.

Setting Custom Log Levels

This section explains how to configure custom logging levels for applications that make use of the java.util.logging package and access the Application Server's logging sub system.

The java.util.logging package provides a hierarchical name space in which logger instances can be created. Whether a particular logging record is output to an Application Server instance's log file depends on the log level of the Log Record and the log level specified.

The Application Serverlogger settings configuration provides over twenty logging modules that allow fine grained control over the Application Server's own internal logging. There is also an option to create additional custom Log Modules by specifying a module name and the logging level that the module should use.

The important point here is that the logger is a static name and no inheritance is provided. Therefore, if a custom logger is configured with the name com.someorg.app and an application attempts to look up the logger com.someorg.app.submodule, then it will not be provided with a logger that inherits the settings from com.someorg.app. Instead, com.someorg.app.submodule will have a default logger that is set to log at the INFO level or higher.

If an application needs to use logger inheritance, this can be configured by editing the logging.properties file of the Java runtime that is being used to run the Application Server. For example, adding the following entry to the logging.properties file, would result in com.someorg.app.submodule inheriting the same FINE level when it is created:

com.someorg.app.level = FINE

For more details about the Java logging API, refer to the Java documentation at http://java.sun.com/j2se/1.5.0/docs/api/java/util/logging/package-summary.html, as well as the other java.util.logging classes.

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 Administration Console. 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