Sun Java™ System Application Server Platform Edition 8 Administration Guide |
Chapter 14
LoggingThis chapter briefly describes how to use the Admin Console to configure logging and view the server log. It contains the following sections:
About LoggingLog Records
The Sun Java System Application Server Platform Edition 8 uses the Java 2 platform Logging API specified in JSR 047. Logging messages are recorded in the server log, normally found at install_dir
/domains/domain1/logs/server.log
.The components of the Application Server generate logging output. You may also specify loggers for your own application components.
Log records follow a uniform format:
[#|yyyy-mm-ddThh:mm:ss.SSS-Z|Log Level|ProductName_Version|LoggerName|Key Value Pairs|MessageId: Message|#]
For example:
[#|2004-01-29T11:43:43.516-0500|INFO|sun-appserver-pe8.0|javax.enterprise. system.core|_ThreadID=14;|CORE5004: Resource Deployed: [ccp:jms/DurableTopicConnectionFactory].|#]
In this example,
[#
and#]
mark the beginning and end of the record.- The vertical bar (
|
) separates the record fields.- 2004-01-29T11:43:43.516-0500 specifies the date and time.
- The Log Level is
INFO
. This level may have any of the following values:SEVERE
,WARNING
,INFO
,CONFIG
,FINE
,FINER
, andFINEST
.- The ProductName_Version is
sun-appserver-pe8.0
.- The LoggerName is a hierarchical logger namespace that identifies the source of the log module, in this case
javax.enterprise.system.core
. All logger names begin with eitherjavax.enterprise.system
orjavax.enterprise.core
.- The Key Value Pairs are key names and values, typically a thread ID such as
_ThreadID=14;
.- The MessageId is an identifier that is provided for all
SEVERE
andWARNING
messages and manyINFO
messages. Typically it consists of a module code and a numerical value, such asADM1042
or, in this case,CORE5004
.- The Message is the text of the log message.
The log record format may be changed or enhanced in future releases.
The Logger Namespace Hierarchy
The Sun Java System Application Server Platform Edition 8 provides a logger for each of its modules. Table 14-1 lists the names of the modules and the namespace for each logger in the order in which they appear on the Log Levels page (see Configuring Log Levels). The last four modules in the table do not appear on the Log Levels page.
Admin Console Tasks for LoggingConfiguring General Logging Settings
On the Logging Settings page, you can customize logging using the following fields:
- 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 install_dir
/domains/domain1/logs/server.log
.- Log Messages to Standard Error: To send logging messages to both standard error and the server log file whether or not you use the
--verbose
option to start the Application Server, select the Enabled checkbox. By default, when you do not use the--verbose
option, the messages go only to the server log file.- Write to System Log: On Solaris systems only, to send logging output to the Solaris
syslog
facility in addition to the server log, select the Enabled checkbox.- Log Handler: To send logs to a destination other than
server.log
orsyslog
, you can plug in a custom log handler. The custom handler must extend the classjava.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 can be 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 interfacejava.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 can be 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 fileserver.log_
date, where date is the date and time when the file was rotated. The default value is 2 gigabytes. The minimum value for the limit is 500 kilobytes; if you specify a lower value, the file will rotate when it reaches 500 Kbytes.Click Save to save your changes.
When you make changes to this page, you must stop and restart the server in order for the changes to take effect.
Configuring Log Levels
- In the tree component, select the Application Server node.
- Click the Logging tab.
- On the Logging Settings page, click Log Levels.
- On the Module Log Levels page, choose a new value from the combo box opposite the module or modules whose log level you wish to change. The default level is
INFO
, meaning that messages at that level or higher (WARNING
,SEVERE
) will appear in the log. You may specify any of the following values (listed from highest to lowest):- Use the Additional Properties area to configure log levels for any application loggers you specified on the Logging Settings page. The property name is the logger namespace, and the value is one of the eight possible levels.
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
- Click Save to save your changes, or click Load Defaults to restore the default values.
Calls to
System.out.println
will be logged at theINFO
level using the logger namejavax.enterprise.system.stream.out
. Calls toSystem.err.println
will be logged at theWARNING
level using the logger namejavax.enterprise.system.stream.err
. To turn off the logs from these sources, specify the logger name with the valueOFF
in the Additional Properties area.Changes to the Log Level settings take effect immediately. They are also saved in the
domain.xml
file to be used when the server restarts.Viewing the Server Log
The most recent 40 entries in the server log appear, with the settings you 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.
Note
Click Modify Search to go to an area that allows you to customize and filter the log viewer. Use the fields as follows:
- Timestamp: To view the most recent messages, select Most Recent (the default). To view messages only from a certain period of time, select Specific Range and type a date and time value in the From and To fields. For the Time value, the syntax must take the following form (SSS stands for milliseconds):
hh:mm:ss.SSS
- Custom Logger: To view messages from loggers specific to your application, type the logger names in the text field, one per line. If your application has several modules, you may view any or all of them. For example, suppose your application has loggers with the following names:
com.mycompany.myapp.module1
com.mycompany.myapp.module2
com.mycompany.myapp.module3
To view messages from all modules in the application, type
com.mycompany.myapp
. To view messages frommodule2
only, typecom.mycompany.myapp.module2
.To view the messages from Tomcat, type
org.apache
in this field.If you specify one or more custom loggers, messages from the Application Server modules will not appear.