Sun GlassFish Enterprise Server v3 Administration Guide

Setting Log Levels

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 List the Logger Levels

Use the list-logger-levels subcommand in remote mode to list the modules and their current log levels.

  1. Ensure that the server is running.

    Remote subcommands require a running server.

  2. List the existing module loggers by using the list-logger-levels(1) subcommand.


Example 7–1 Listing Logger Levels for Modules

This example shows a partial list of the existing loggers and indicates how their log levels are set.


asadmin> list-logger-levels
javax.enterprise.system.container.cmp: INFO
javax.enterprise.system.tools.admin: INFO
java.util.logging.ConsoleHandler: FINEST
javax.enterprise.system.container.web: INFO
javax.enterprise.system.util: INFO
javax.enterprise.resource.webcontainer.jsf.timing: INFO
javax: INFO
javax.enterprise.resource.corba: INFO
...
Command list-logger-levels executed successfully.

See Also

You can also view the full syntax and options of the subcommand by typing asadmin help list-logger-levels at the command line.

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).

You configure global logging by editing the logging.properties file. The default logging.properties file is located in the same directory as the domain.xml file, typically domain-dir/config. You can choose a different file name by using the java.util.logging.config.file system property to specify a file name. For example:


java -Djava.util.logging.config.file=myfile

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 7–2 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. This example sets the log level for all loggers to INFO:

.level= INFO

ProcedureTo Set Module Logger Levels

A module log level specifies which kinds of events are logged for a particular logger. The default level for message output to the console is INFO (which also includes SEVERE and WARNING messages). The global log level is overridden by a module-specific log level.

By default, the module log level is set to FINE. 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

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

  1. Ensure that the server is running.

    Remote subcommands require a running server.

  2. List the existing module loggers by using the list-logger-levels(1) subcommand.

  3. Set the log level for a module by using the set-log-level(1) subcommand.

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


Example 7–3 Setting the Log Level for a Module Logger

This example sets the log level for the web container logger to FINE.


asadmin> set-log-level javax.enterprise.system.container.web.level=FINE
Command set-log-level executed successfully.


Example 7–4 Setting Log Levels for Multiple Loggers

This example sets the log level for security and web container loggers.


asadmin> set-log-level javax.enterprise.system.core.security.level=FINE
javax.enterprise.system.container.web=WARNING 
Command set-log-level executed successfully.

See Also

You can also view the full syntax and options of the subcommand by typing asadmin help set-log-level at the command line.