Reaction Home

com.zynaptic.reaction.util
Class ReactorLogOsgiOptional

java.lang.Object
  extended by com.zynaptic.reaction.util.ReactorLogOsgiOptional
All Implemented Interfaces:
ReactorLogTarget

public class ReactorLogOsgiOptional
extends java.lang.Object
implements ReactorLogTarget

This class provides support for logging to an optional OSGi logging service. Availability of a suitable OSGi logging bundle is checked on startup and if available will be used for the entire lifecycle of the Reaction bundle. A fallback logging target is specified on startup which will be used if a suitable OSGi service is not available.


Field Summary
 
Fields inherited from interface com.zynaptic.reaction.util.ReactorLogTarget
LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_WARNING
 
Constructor Summary
ReactorLogOsgiOptional(BundleContext bundleContext, ReactorLogTarget backupLogTarget)
          Default constructor for the optional OSGi logging service.
 
Method Summary
 void log(int level, java.lang.String message)
          Log message string at the specified severity level.
 void log(int level, java.lang.String message, java.lang.Throwable exception)
          Log message string and accompanying exception information at the specified severity level.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReactorLogOsgiOptional

public ReactorLogOsgiOptional(BundleContext bundleContext,
                              ReactorLogTarget backupLogTarget)
Default constructor for the optional OSGi logging service. Attaches to the OSGi log service if available and falls back to the backup logging target if not.

Parameters:
bundleContext - This is the OSGi bundle context associated with the Reaction bundle.
backupLogTarget - This is the backup logging target which will be used if the optional OSGi log service is not available.
Method Detail

log

public void log(int level,
                java.lang.String message)
Description copied from interface: ReactorLogTarget
Log message string at the specified severity level.

Specified by:
log in interface ReactorLogTarget
Parameters:
level - This is the severity level at which the message should be logged.
message - This is the message string which should be included in the log file.

log

public void log(int level,
                java.lang.String message,
                java.lang.Throwable exception)
Description copied from interface: ReactorLogTarget
Log message string and accompanying exception information at the specified severity level.

Specified by:
log in interface ReactorLogTarget
Parameters:
level - This is the severity level at which the message should be logged.
message - This is the message string which should be included in the log file.
exception - This is the exception which should be logged with the accompanying message.

Reaction Home