GridGain™ 2.1.0
Java API Specification

org.gridgain.grid.logger
Interface GridLogger

All Known Implementing Classes:
GridJavaLogger, GridJbossLogger, GridJclLogger, GridLog4jLogger

@Apache20LicenseCompatible
@GridToStringExclude
public interface GridLogger

This interface defines basic logging functionality used throughout the system. We had to abstract it out so that we can use whatever logging is used by the hosting environment. Currently, log4j, JBoss, JCL and console logging are provided as supported implementations.

GridGain logger could be configured either from code (for example log4j logger):

      GridConfiguration cfg = new GridConfigurationAdapter();
      ...
      File xml = GridUtils.resolveGridGainPath("modules/tests/config/log4j-test.xml");
      GridLogger log = new GridLog4jLogger(xml);
      ...
      cfg.setGridLogger(log);
 
or in grid configuration file (see JCL logger example below):
      ...
      <property name="gridLogger">
          <bean class="org.gridgain.grid.logger.jcl.GridJclLogger">
              <constructor-arg type="org.apache.commons.logging.Log">
                  <bean class="org.apache.commons.logging.impl.Log4JLogger">
                      <constructor-arg type="java.lang.String" value="config/default-log4j.xml"/>
                  </bean> 
              </constructor-arg>
          </bean>
      </property>
      ...
 
It's recommended to use GridGain's logger injection instead of using/instantiating logger in your task/job code. See GridLoggerResource annotation about logger injection.



See Also:

  Documentation
  Email Support
  Online Forums
  Issue Tracking

Author:   2005-2008 Copyright © GridGain Systems. All Rights Reserved. ver. 2.1.0

 

Method Summary
 void debug(String msg)
          Logs out debug message.
 void error(String msg)
          Logs out error message.
 void error(String msg, Throwable e)
          Logs error message with optional exception.
 GridLogger getLogger(Object ctgr)
          Creates new logger with given category based off the current instance.
 void info(String msg)
          Logs out information message.
 boolean isDebugEnabled()
          Tests whether debug level is enabled.
 boolean isInfoEnabled()
          Tests whether info level is enabled.
 void warning(String msg)
          Logs out warning message.
 void warning(String msg, Throwable e)
          Logs out warning message with optional exception.
 

Method Detail

getLogger

GridLogger getLogger(Object ctgr)
Creates new logger with given category based off the current instance.

Parameters:
ctgr - Category for new logger.
Returns:
New logger with given category.

debug

void debug(String msg)
Logs out debug message.

Parameters:
msg - Debug message.

info

void info(String msg)
Logs out information message.

Parameters:
msg - Information message.

warning

void warning(String msg)
Logs out warning message.

Parameters:
msg - Warning message.

warning

void warning(String msg,
             Throwable e)
Logs out warning message with optional exception.

Parameters:
msg - Warning message.
e - Optional exception (can be null).

error

void error(String msg)
Logs out error message.

Parameters:
msg - Error message.

error

void error(String msg,
           Throwable e)
Logs error message with optional exception.

Parameters:
msg - Error message.
e - Optional exception (can be null).

isDebugEnabled

boolean isDebugEnabled()
Tests whether debug level is enabled.

Returns:
true in case when debug level is enabled, false otherwise.

isInfoEnabled

boolean isInfoEnabled()
Tests whether info level is enabled.

Returns:
true in case when info level is enabled, false otherwise.

GridGain™ 2.1.0
Java API Specification

GridGain™ - Grid Computing Made Simple, ver. 2.1.0.19122008
2005-2008 Copyright © GridGain Systems. All Rights Reserved.