XAP8 == "XAP9NET" || XAP8 == "XAP9" || XAP8 == "XAP9NET")

GigaSpaces Logging


Search XAP 8.0
Searching XAP 8.0 Documentation
Browse XAP 8.0
Offline Documentation

Download latest offline documentation
in HTML format:

xap-8.0-documentation.zip (15MB)

                                                              

Overview

GigaSpaces makes logging calls by use of the Java TM platform's core logging facilities.
For more information on the JDK logging framework, please refer to the following online documentation: Java Logging Overview.

Configuration File

The logging configuration is initialized using a logging configuration file that is read at startup. This logging configuration file is in the standard java.util.Properties format. It configures custom versions of both java.util.logging.Handler and java.util.logging.Formatter, and default levels for frequently used loggers (categories).

The default configuration file is located under:

<GigaSpaces>/config/gs_logging.properties

Logging Level

The logging level class defines a set of standard logging levels that can be used to control logging output. The logging level are ordered and are specified by ordered integers/constants.

Enabling logging at a given level also enables logging at all higher levels.

The supported logging levels in descending order are:

  • SEVERE (highest value)
  • WARNING
  • INFO
  • CONFIG
  • FINE
  • FINER
  • FINEST (lowest value)

In addition, there is a level OFF that can be used to turn off logging, and a level ALL that can be used to enable logging of all messages.

Logging Categories

The GigaSpaces logging divided into the following categories:

  • Client
  • Communication Protocol
  • Class Loader
  • Space (Caching, Query, Replication, etc)
  • Runtime (GCC, GSM, etc)
  • Security
  • Web Container
  • Mule Integration
  • Management

For each category there are various logger name you should use when configuring the logging level. See gs_logging.properties file for exact logger name supported for each category. You can find all logger names also at the com.gigaspaces.logger.Constants class.

Here are the different modules , their logging names and their default logging level:

Overriding the Default Configuration

The configuration defined in the gs_logging.properties file may be overridden by either using system properties or by providing an external configuration file with overrides. This external configuration file should be located in the classpath under:

/config/gs_ext_logging.properties

Any configuration that you wish to override in gs_logging.properties file, should appear in gs_ext_logging.properties with its new value. The same applies for system properties, e.g.

-Dcom.gigaspaces.exceptions.level=WARNING

Defining System Properties when Starting GSCs, GSMs and other runtime components

The recommended way to define system properties when starting service grid components is to wrap the original script, e.g. gsc.sh(bat) with a wrapper script which include the EXT_JAVA_OPTIONS variable. The setenv.sh(bat) script which is used by these components will pick these options automatically and use them as JVM arguments.

Overriding the Configuration File

Your own configuration file may also be used instead of the platform's default. This is done by setting the configuration file location using a system property:

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

GigaSpaces scripts rely on the exported environment variable GS_LOGGING_CONFIG_FILE (declared in <GigaSpaces>/bin/setenv script). The preferred way to apply your override file is to use a wrapper script: export the new setting of this variable and call the original script. This ensures that when setenv.sh(bat) is called from within the platform's scripts, it will pick up the override.

# unix
export GS_LOGGING_CONFIG_FILE=myfile.properties
./gsc.sh

Provided that your application initializes the logging facility via the Logging API (e.g. LogManager.readConfiguration(InputStream ins)), you may wish to disable the GigaSpaces configuration altogether. Once disabled, your Java logging settings will take place. This is done with the following system property:

-Dcom.gs.logging.disabled=true

Troubleshooting

To troubleshoot and detect which logging properties file was loaded and from which location, set the following system property to true. This property already exists in the scripts (for convenience) and by default is set to false.

-Dcom.gs.logging.debug=true

Handlers

GigaSpaces out of the box configures logging with two log Handlers,

  • java.util.logging.ConsoleHandler: A simple handler for writing formatted output to System.err (level is set to ALL)
  • com.gigaspaces.logger.RollingFileHandler: A handler that writes formatted output to a file that rolls over if a certain policy is triggered. see Managing Log Files

Java util logging supports other handlers. MemoryHandler, SocketHandler or any other handler can be used instead of the above. More information about handlers is here. You can also use one of the open source logging frameworks that support java.util.logging.

Formatters

Formatters are in charge of formatting the log messages and adding meta data to them (date, time, level, etc).
GigaSpaces configures the logging Handler's formatter property with a single Formatter implementation class:
com.gigaspaces.logger.GSSimpleFormatter. This formatter class is based on the java.util.logging.SimpleFormatter class. see Formatting Log Messages for more details.

Exception visibility

GigaSpaces prints exception stack traces for messages with level SEVERE or higher.

com.gigaspaces.exceptions.level = SEVERE

Messages with lower levels with only be logged with the exception's toString() value. To force the logger to print the stack trace of exception with lower levels, such as Level WARNING for example, set the com.gigaspaces.exceptions.level property to WARNING.

Note that if the exception is a java.lang.RuntimeException its stack trace will always be logged, regardless of the level definition.

Logging Management at Runtime

It is possible to change various logger level settings while the system is up and running without the need to restart it.
This can be very useful in production environments when the system needs to be troubleshooted, but at the same time cannot be restarted.

You can do so by connecting to the JMX Bean of the Java logging facility via JConsole for example.
You can start JConsole for a specific running GSC or GSM using the GigaSpaces Managment Center (<GigaSpaces>\bin\gs-ui.sh(bat)).
To change the logging level in JConsole do the following:

  1. Traverse to the MBeans tab
  2. Expand the java.util.logging tree node and locate the Logging tree node
  3. Select the Operations tab
  4. Type the logger's name and level for the arguments of the setLoggerLevel() method. For example, If you want to change com.gigaspaces.exceptions.level level to WARNING, use setLoggerLevel(com.gigaspaces.exceptions, WARNING).
Starting JConsole from the GS-UI or using JConsole with the JTop plug-in, may impact the JVM garbage collection behavior of the monitored JVM. See more details here. To disable the JTop Tab when starting JConsole please rename the JAVA_HOME\demo\management\JTop\JTop.jar.

Note, you will need to use the logging level without the .level string e.g.: "com.gigaspaces.core.cluster.replication" and set value "FINE"

The LoggingMXBean enables you to:

  • Get the name of the log level associated with the specified logger
  • Get the list of currently registered loggers
  • Get the name of the parent for the specified logger
  • Sets the specified logger to the specified new level

FAQ

How do I minimize cost when migrating to 7.0 ?

Section Contents

IMPORTANT: This is an old version of GigaSpaces XAP. Click here for the latest version.

Additional resources: XAP Application Server | XAP Data Grid | XAP for Cloud Computing | XAP J2EE Support

Labels

 
(None)