com.ibm.are.service
Class LoggingService

java.lang.Object
  extended by com.ibm.are.service.BaseSingletonService
      extended by com.ibm.are.service.LoggingService
All Implemented Interfaces:
com.ibm.are.core.Element, AutoStartSingletonService, Service, SingletonService

public final class LoggingService
extends BaseSingletonService
implements AutoStartSingletonService

The LoggingService class is final class that implements the AutoStartSingletonService interface. This following services are provided by this class:

By far the most valuable feature of this service is the ability to easily retrieve a reference to the global logger. All of the plugins shipped as part of the Application Runtime Expert use the global logger. So developers of their own plugins should consider also using the global logger; having all plugins log to the same file makes it easy to find and correlate log entries for all plugins.

Here is an example of how to retrieve a reference to the global logger. This example will work from any service or plugin:

        ElementManager elementMgr = AreCore.get().elementManager();
        Service loggingService = elementMgr.findService("com.ibm.are.service.LoggingService");
        Logger globalLogger = ((LoggingService)loggingService).getGlobalLogger();
 

Because logging is an integral part of serviceability for this product, this service has a special contract with the Application Runtime Expert. The runtime guarantees that this service will always be the very first service started. What this means is that the LoggingService is guaranteed to be available for use by all services and plugins, regardless of when they are discovered or instantiated by the runtime.

Version:
1.0
Author:
IBM

Field Summary
static java.lang.String COPYRIGHT
          Copyright for class bytecode
 
Fields inherited from class com.ibm.are.service.BaseSingletonService
serviceData
 
Constructor Summary
LoggingService()
          Default constructor
 
Method Summary
 java.util.logging.Logger createLogger(java.lang.String packageName, java.lang.String logFileName)
          Creates a customized logger based on the input parameters.
 java.util.logging.Logger createLogger(java.lang.String packageName, java.lang.String logFileName, int maxSize, int maxNumber)
          Creates a customized logger based on the input parameters.
 java.lang.String getCommonName()
          
 java.lang.String getDescription()
          
 java.util.logging.Logger getGlobalLogger()
          Retrieves a reference to the global logger
 Version getVersion()
          
protected  void startImpl(java.util.List startArgs)
          Starts the service.
protected  void stopImpl(java.util.List stopArgs)
          Stops the service.
 
Methods inherited from class com.ibm.are.service.BaseSingletonService
getElementData, setElementData, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.are.service.Service
start, stop
 
Methods inherited from interface com.ibm.are.core.Element
getElementData, setElementData
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
Copyright for class bytecode

See Also:
Constant Field Values
Constructor Detail

LoggingService

public LoggingService()
Default constructor

Method Detail

startImpl

protected void startImpl(java.util.List startArgs)
Starts the service. During startup the global logger is created and initialized.

Specified by:
startImpl in class BaseSingletonService
Parameters:
startArgs - Start arguments. Currently no start arguments are defined for this service.

stopImpl

protected void stopImpl(java.util.List stopArgs)
Stops the service. Before the service is stopped, all handles for the global logger will be flushed and closed.

Specified by:
stopImpl in class BaseSingletonService
Parameters:
stopArgs - Start arguments. Currently no start arguments are defined for this service.

getCommonName

public java.lang.String getCommonName()

Specified by:
getCommonName in interface com.ibm.are.core.Element

getDescription

public java.lang.String getDescription()

Specified by:
getDescription in interface com.ibm.are.core.Element

getVersion

public Version getVersion()

Specified by:
getVersion in interface com.ibm.are.core.Element

getGlobalLogger

public java.util.logging.Logger getGlobalLogger()
Retrieves a reference to the global logger

Returns:
A reference to the global logger

createLogger

public java.util.logging.Logger createLogger(java.lang.String packageName,
                                             java.lang.String logFileName)
Creates a customized logger based on the input parameters.

Parameters:
packageName - The package name will be used as the name of the logger
logFileName - The name of the log file
Returns:
A newly created logger or null if an exception occurred during creation

createLogger

public java.util.logging.Logger createLogger(java.lang.String packageName,
                                             java.lang.String logFileName,
                                             int maxSize,
                                             int maxNumber)
Creates a customized logger based on the input parameters.

Parameters:
packageName - The package name will be used as the name of the logger
logFileName - The name of the output file used when writing log entries
maxSize - The maximum size, in bytes, of each log file
maxNumber - The maximum number of log files to generate before re-using the oldest one
Returns:
A newly created logger or null if an exception occurred during creation