Sun GlassFish Enterprise Server v3 Prelude Administration Guide

Setting Log Levels

The log level describes the type of material that is contained in the message. The following values apply: SEVERE, WARNING, INFO, CONFIG, FINE, FINER, and FINEST. These log levels are hierarchically inclusive, which means that if you set a particular log level, such as INFO, the messages that have log levels above that level (SEVERE and WARNING) are also included. If you set the log level to the lowest level, FINEST, your output will include all the messages in the file. The default setting is INFO.

There are two levels of log settings available: global and logger-specific. If you have chosen a logger-specific setting that is different from the global setting, the logger-specific setting takes precedence.

Because setting log levels is a dynamic operation, you do not need to restart Enterprise Server for changes to take effect.

The following topics are addressed here:

ProcedureTo Set the Global Log Level

The global log level specifies which kinds of events are logged across all loggers. The default level for message output to the console is INFO (which also includes SEVERE and WARNING messages).

The ConsoleHandler has a separate log level setting that limits the messages that are displayed. For example:


java.util.logging.ConsoleHandler.level = INFO 
java.util.logging.ConsoleHandler.formatter = 
com.sun.enterprise.server.logging.UniformLogFormatter
  1. In a text editor, find the ConsoleHandler log level line and make your changes.

  2. Save the file.


Example 9–3 Changing the Global Log Level for All Loggers

If you set the log level at the root level, you are setting the level of all loggers. The following example sets the log level for all loggers to INFO:

.level= INFO

ProcedureTo Set Logger-Specific Properties

Logger-specific properties provide extra control for the logger of each module. By default, these properties are set to log level FINE in the logging. properties file, however, the lines in the file are commented out. The lines for the loggers might look like this (the modules are indicated in bold):


#javax.enterprise.system.tools.level=FINE
#javax.enterprise.system.container.ejb.level=FINE
#javax.enterprise.system.core.security.level=FINE
#javax.enterprise.system.tools.admin.level=FINE
#javax.enterprise.level=FINE
#javax.enterprise.system.container.web.level=FINE

For any given module logger, such as the EJB logger, the global log level can be overridden by the module-specific setting.

  1. In a text editor, uncomment the line that applies to the logger that you want to modify.

    Remove the #. The logger is activated using the default level INFO.

  2. Set the property to the desired log level.

    Your choices are SEVERE, WARNING, INFO, CONFIG, FINE, FINER, and FINEST.

  3. Save the file.

    The log levels are automatically updated.


Example 9–4 Changing the Log Level for the Console Handler

The following example changes the log level for ConsoleHandler from INFO to FINE

Before:


java.util.logging.ConsoleHandler.level = INFO

After:


java.util.logging.ConsoleHandler.level = FINE


Example 9–5 Setting a Log Level for a Specific Logger

The following example sets the log level for the EJB logger to SEVERE (overriding the global level INFO)

Before:

#javax.enterprise.system.container.ejb.level=FINE

After: :

javax.enterprise.system.container.ejb.level=SEVERE