ariba.util.log
Class ExceptionLogService

java.lang.Object
  extended by ariba.util.log.ExceptionLogService

public abstract class ExceptionLogService
extends java.lang.Object

Service to trap and log exceptions that would otherwise go unhandled


Field Summary
static ThreadDebugKey ExceptionContextObjectKey
          Allows the caller to set a context object to be associated to exceptions that may occur while handling that object.
 
Constructor Summary
ExceptionLogService()
           
 
Method Summary
static ExceptionLogService getService()
           
abstract  long onException(java.lang.Object contextObjectId, java.lang.Throwable exception)
          Log an exception.
abstract  long onException(org.apache.log4j.Priority level, java.lang.Object contextObjectId, java.lang.Throwable exception, java.lang.String message)
          Log an exception.
abstract  long onException(java.lang.Throwable exception)
          Log an exception.
static void setService(ExceptionLogService service)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ExceptionContextObjectKey

public static final ThreadDebugKey ExceptionContextObjectKey
Allows the caller to set a context object to be associated to exceptions that may occur while handling that object. The value may be a ClusterRoot or a BaseId. Note that care needs to be taken when using this paradigm, as lots of background processing may happen in new threads.

Constructor Detail

ExceptionLogService

public ExceptionLogService()
Method Detail

onException

public abstract long onException(java.lang.Throwable exception)
Log an exception. Note that this method should only be called for unexpected exceptions. This writes to the database, so the caller should be aware that frequent calls to this method are costly. If a context object was set for the key ExceptionContextObjectKey in the ThreadDebugState the exception will be associated to that object.

Parameters:
exception - - Exception to be logged.
Returns:
a long integer specifying the success or failure of the logging.

onException

public abstract long onException(java.lang.Object contextObjectId,
                                 java.lang.Throwable exception)
Log an exception. Note that this method should only be called for unexpected exceptions. This writes to the database, so the caller should be aware that frequent calls to this method are costly. If a no context object is passed, but a context object was set for the key ExceptionContextObjectKey in the ThreadDebugState the exception will be associated to that object, else it will be associated to the context object passed in.

Parameters:
contextObjectId - - a BaseId or ClusterRoot, if a context for this exception is available. Can be null.
exception - - Exception to be logged
Returns:
a long integer specifying the success or failure of the logging.

onException

public abstract long onException(org.apache.log4j.Priority level,
                                 java.lang.Object contextObjectId,
                                 java.lang.Throwable exception,
                                 java.lang.String message)
Log an exception. Note that this method should only be called for unexpected exceptions. This writes to the database, so the caller should be aware that frequent calls to this method are costly. If a no context object is passed, but a context object was set for the key ExceptionContextObjectKey in the ThreadDebugState the exception will be associated to that object, else it will be associated to the context object passed in.

Parameters:
level - - log level (INFO, WARN or ERROR)
contextObjectId - - a BaseId or ClusterRoot, if a context for this exception is available. Can be null.
exception - - Exception to be logged
message - - custom message text
Returns:
a long integer specifying the success or failure of the logging.

setService

public static void setService(ExceptionLogService service)

getService

public static ExceptionLogService getService()


AribaWeb User Interface Development Framework
Copyright © 2000-2014 Ariba, Inc. All Rights Reserved.