Logging is the process by which Oracle GlassFish Server captures information about events that occur, such as configuration errors, security failures, or server malfunction. This data is recorded in log files and is usually the first source of information when problems occur. Analyzing the log files can help you to determine the health of the server.
Although application components can use the Apache Commons Logging Library to record messages, the platform standard JSR 047 API is recommended for better log configuration.
The following topics are addressed here:
Oracle GlassFish Server log records are captured in one of two general types of log files:
Server log files, which capture information about the operation of a server instance running in the domain. Each instance, managed server instance (that is, each cluster member), and the domain administration server (DAS) has an individual server log file.
Cluster log files, which capture information about the operation of a cluster instance, if one or more are configured in the domain. Each managed server instance that is a member of a cluster has a cluster log file in addition to a server log file. However, the contents of the cluster log file may differ from one instance to another depending on factors such as how instances are apportioned in the cluster, applications running on them, how load balancing is configured, and failover state.
The following topics are addressed here:
In an Oracle GlassFish Server domain, log files have the following names and locations by default:
For example, in a domain hosted on a given machine that includes a cluster with two managed servers (ClusterServer1 and ClusterServer1) and a standalone instance (StandaloneServer), the log files might be arranged in the following directory structure. In this directory structure, the server.log file for the DAS is located in domain-dir/logs.
as-install-parent directory glassfish/ domains/ domain-name/ logs/ server.log nodes/ hostname/ ClusterServer1/ logs/ server.log cluster.log ClusterServer2/ logs/ server.log cluster.log StandaloneServer/ logs/ server.log
You can change the default name or location of a log file by modifying the logging properties file for the corresponding instance, described in To Change the Name and Location of the Log File.
Oracle GlassFish Server log records follow a uniform format:
[#|yyyy-mm-ddThh:mm:ss.SSS-Z|Log Level|ProductName-Version|LoggerName|Key Value Pairs|Message|#]
[# and #] mark the beginning and end of the record.
The vertical bar (|) separates the fields of the record.
yyyy-mm-ddThh:mm:ss.SSSS-Z represents the date and time that the record was created. For example: 2006-10-21T13:25:53.852-0400
Log Level represents the log level. You can set any of the following values: SEVERE, WARNING, INFO, CONFIG, FINE, FINER, and FINEST. The default is INFO.
ProductName-Version represents the current version of the Oracle GlassFish Server. For example: glassfish
LoggerName represents a hierarchical logger namespace that identifies the source of the log module. For example: javax.enterprise.system.core
Key Value Pairs represents pairs of key names and values, typically a thread ID. For example: _ThreadID=14;
Message represents the text of the log message. For all Oracle GlassFish Server SEVERE and WARNING messages and for many INFO messages, the message begins with a message ID that consists of a module code and a numerical value. For example: CORE5004
The following is an example of a log record:
[#|2006-10-21T13:25:53.852-0400|INFO|GlassFish10.0|javax.enterprise. system.core|_ThreadID=13;|CORE5004: Resource Deployed: [cr:jms/DurableConnectionFactory].|#]
The Administration Console presents log records in a more readable display.
By default, when a log file grows to 2 MB, Oracle GlassFish Server renames (rotates) the file to incorporate a timestamp and creates a new log file. The log file is renamed as log-type.log_date, where log-type represents either server or cluster, and date represents the time of rotation.
You can configure the logging service to change the default settings for log file rotation, as explained in Setting Log File Rotation.
Oracle GlassFish Server provides a logger for each of its modules. The following list is an example of the logger namespaces in a server instance as they appear when using the list-log-levels subcommand.
java.util.logging.ConsoleHandler <FINEST> javax.enterprise.resource.corba <INFO> javax.enterprise.resource.javamail <INFO> javax.enterprise.resource.jdo <INFO> javax.enterprise.resource.jms <INFO> javax.enterprise.resource.jta <INFO> javax.enterprise.resource.resourceadapter <INFO> javax.enterprise.resource.sqltrace <INFO> javax.enterprise.resource.webcontainer.jsf.application <INFO> javax.enterprise.resource.webcontainer.jsf.config <INFO> javax.enterprise.resource.webcontainer.jsf.context <INFO> javax.enterprise.resource.webcontainer.jsf.facelets <INFO> javax.enterprise.resource.webcontainer.jsf.lifecycle <INFO> javax.enterprise.resource.webcontainer.jsf.managedbean <INFO> javax.enterprise.resource.webcontainer.jsf.renderkit <INFO> javax.enterprise.resource.webcontainer.jsf.resource <INFO> javax.enterprise.resource.webcontainer.jsf.taglib <INFO> javax.enterprise.resource.webcontainer.jsf.timing <INFO> javax.enterprise.system.container.cmp <INFO> javax.enterprise.system.container.ejb <INFO> javax.enterprise.system.container.ejb.mdb <INFO> javax.enterprise.system.container.web <INFO> javax.enterprise.system.core.classloading <INFO> javax.enterprise.system.core.config <INFO> javax.enterprise.system.core.naming <INFO> javax.enterprise.system.core.security <INFO> javax.enterprise.system.core.selfmanagement <INFO> javax.enterprise.system.core.transaction <INFO> javax.enterprise.system <INFO> javax.enterprise.system.tools.admin <INFO> javax.enterprise.system.tools.backup <INFO> javax.enterprise.system.tools.deployment <INFO> javax.enterprise.system.util <INFO> javax.enterprise.system.webservices.registry <INFO> javax.enterprise.system.webservices.rpc <INFO> javax.enterprise.system.webservices.saaj <INFO> javax <INFO> org.apache.catalina <INFO> org.apache.coyote <INFO> org.apache.jasper <INFO> org.jvnet.hk2.osgiadapter <INFO>
For information about how to display logger namespaces and log levels, see To List Log Levels.
Each instance in an Oracle GlassFish Server domain has a dedicated log file, and each instance and cluster has its own logging properties file. To configure logging for an instance or a cluster, Oracle GlassFish Server allows you target specific log files or logging properties files when you do the following:
Set global or module-specific log levels
Rotate log files or compress them into a ZIP archive
Change logging property attributes
List log levels or log attributes
The following subcommands optionally accept a target specification. A target can be a configuration name, server name, cluster name, or instance name, and is specified as either an operand or as a value passed using the --target option. If no target is specified when using any of these subcommands, the default target is the DAS.
The DAS as well as each configuration, instance, and cluster has its own set of logging properties that are maintained in individual configuration files. A logging properties file is named logging.properies and includes the following information:
Log file name and location
Logger names and levels
Properties for custom handlers
Log rotation and logger format properties
By default in an Oracle GlassFish Server domain, logging properties files are created in the following locations:
For information about configuring logging properties, see Configuring the Logging Service.