net.kwfgrid.gwes
Class GWESLogger

java.lang.Object
  extended by net.kwfgrid.gwes.GWESLogger
Direct Known Subclasses:
GWESBasicLogger

public abstract class GWESLogger
extends Object

This is an abstract class for logging all user access to the GWES engine, workflows and activities. You may develop your own implementation of this class, regarding your logging requirements. The default implementation is net.kwfgrid.gwes.GWESBasicLogger. Use property "gwes.logger.class" in gwes.properties to configure the implementation of the GWESLogger.

Version:
$Id$
Author:
Andreas Hoheisel (www.andreas-hoheisel.de)

Nested Class Summary
static class GWESLogger.Event
          Type of event.
static class GWESLogger.EventOutcome
          Outcome of the event.
static class GWESLogger.Level
          Level of logging.
 
Constructor Summary
protected GWESLogger()
          Only for internal usage, use getInstance() to get instance of GWESLogger.
 
Method Summary
 boolean e()
          ERROR enabled
 boolean f()
          FATAL enabled
 String getGwesId()
           
static GWESLogger getInstance()
          Get instance of GWESLogger implementation.
 GWESLogger.Level getLevel()
          Get the logger level.
 boolean i()
          INFO enabled
 void logEvent(GWESLogger.Event event, GWESLogger.EventOutcome eventOutcome, String userID, Object object, String[] paramNames, String[] oldValues, String[] newValues, Throwable exception)
          Log an event.
 void logEvent(GWESLogger.Event event, GWESLogger.EventOutcome eventOutcome, String userID, Object object, Throwable exception)
          Log an event without parameter.
 void logEvent(GWESLogger.Event event, String userID, Object object)
          Log an successful event with EventOutcome.SUCCESS without parameter.
 void logEvent(GWESLogger.Event event, String userID, Object object, String[] paramNames, String[] oldValues, String[] newValues)
          Log an successful event with EventOutcome.SUCCESS and multiple parameters.
protected abstract  void logEventLevelChecked(GWESLogger.Event event, GWESLogger.EventOutcome eventOutcome, String userID, Object object, String[] paramNames, String[] oldValues, String[] newValues, Throwable exception)
          Log an event.
 void logEventSP(GWESLogger.Event event, GWESLogger.EventOutcome eventOutcome, String userID, Object object, String paramName, String oldValue, String newValue, Throwable exception)
          Log an event with single parameter.
 void logEventSP(GWESLogger.Event event, String userID, Object object, String paramName, String oldValue, String newValue)
          Log an successful event with EventOutcome.SUCCESS and with single parameter.
 boolean q()
          QUIET enabled
 void setLevel(GWESLogger.Level level, String userID)
          Set the logger level.
 boolean w()
          WARN enabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GWESLogger

protected GWESLogger()
Only for internal usage, use getInstance() to get instance of GWESLogger.

Method Detail

getInstance

public static GWESLogger getInstance()
                              throws LoggingException
Get instance of GWESLogger implementation. Reads property "gwes.logger.class" from gwes.properties.

Returns:
The instance of GWESLogger as defined in gwes.properties.
Throws:
LoggingException - If it was not possible to create a GWESLogger instance.

getLevel

public GWESLogger.Level getLevel()
Get the logger level.

Returns:
The logger level.

i

public boolean i()
INFO enabled

Returns:
returns true if level is greater or equal Level.INFO.

w

public boolean w()
WARN enabled

Returns:
returns true if level is greater or equal Level.WARN.

e

public boolean e()
ERROR enabled

Returns:
returns true if level is greater or equal Level.ERROR.

f

public boolean f()
FATAL enabled

Returns:
returns true if level is greater or equal Level.FATAL.

q

public boolean q()
QUIET enabled

Returns:
returns true if level is greater or equal Level.QUIET.

setLevel

public void setLevel(GWESLogger.Level level,
                     String userID)
              throws LoggingException
Set the logger level.

Parameters:
level - The new logger level.
userID - The user ID of the user, who is responsible for invoking this method.
Throws:
LoggingException

getGwesId

public String getGwesId()

logEventSP

public void logEventSP(GWESLogger.Event event,
                       GWESLogger.EventOutcome eventOutcome,
                       String userID,
                       Object object,
                       String paramName,
                       String oldValue,
                       String newValue,
                       Throwable exception)
                throws LoggingException
Log an event with single parameter.

Parameters:
event - The type of event, refer to GWESLogger.Event.
eventOutcome - The event outcome, refer to GWESLogger.EventOutcome.
userID - The user ID of the user who triggered this event, or null if not available.
object - The object which is related to the event, e.g. the Workflow or Activity instance, or null if not available.
paramName - The parameter names.
oldValue - The old value of the parameter.
newValue - The new value of the parameter.
exception - The exception if event outcome was not GWES.Logger.EventOutcome.SUCCESS, or null if not available.
Throws:
LoggingException - If logging fails.

logEvent

public void logEvent(GWESLogger.Event event,
                     GWESLogger.EventOutcome eventOutcome,
                     String userID,
                     Object object,
                     Throwable exception)
              throws LoggingException
Log an event without parameter.

Parameters:
event - The type of event, refer to GWESLogger.Event.
eventOutcome - The event outcome, refer to GWESLogger.EventOutcome.
userID - The user ID of the user who triggered this event, or null if not available.
object - The object which is related to the event, e.g. the Workflow or Activity instance, or null if not available.
exception - The exception if event outcome was not GWES.Logger.EventOutcome.SUCCESS, or null if not available.
Throws:
LoggingException - If logging fails.

logEvent

public void logEvent(GWESLogger.Event event,
                     String userID,
                     Object object,
                     String[] paramNames,
                     String[] oldValues,
                     String[] newValues)
              throws LoggingException
Log an successful event with EventOutcome.SUCCESS and multiple parameters.

Parameters:
event - The type of event, refer to GWESLogger.Event.
userID - The user ID of the user who triggered this event, or null if not available.
object - The object which is related to the event, e.g. the Workflow or Activity instance, or null if not available.
paramNames - A String array of parameter names.
oldValues - A String array of the old values of the parameters.
newValues - A String array of the new values of the parameters.
Throws:
LoggingException - If logging fails.

logEventSP

public void logEventSP(GWESLogger.Event event,
                       String userID,
                       Object object,
                       String paramName,
                       String oldValue,
                       String newValue)
                throws LoggingException
Log an successful event with EventOutcome.SUCCESS and with single parameter.

Parameters:
event - The type of event, refer to GWESLogger.Event.
userID - The user ID of the user who triggered this event, or null if not available.
object - The object which is related to the event, e.g. the Workflow or Activity instance, or null if not available.
paramName - The parameter names.
oldValue - The old value of the parameter.
newValue - The new value of the parameter.
Throws:
LoggingException - If logging fails.

logEvent

public void logEvent(GWESLogger.Event event,
                     String userID,
                     Object object)
              throws LoggingException
Log an successful event with EventOutcome.SUCCESS without parameter.

Parameters:
event - The type of event, refer to GWESLogger.Event.
userID - The user ID of the user who triggered this event, or null if not available.
object - The object which is related to the event, e.g. the Workflow or Activity instance, or null if not available.
Throws:
LoggingException - If logging fails.

logEvent

public void logEvent(GWESLogger.Event event,
                     GWESLogger.EventOutcome eventOutcome,
                     String userID,
                     Object object,
                     String[] paramNames,
                     String[] oldValues,
                     String[] newValues,
                     Throwable exception)
              throws LoggingException
Log an event. This method checks the logger level to decide, whether this event should be logged or not.

Parameters:
event - The type of event, refer to GWESLogger.Event.
eventOutcome - The event outcome, refer to GWESLogger.EventOutcome.
userID - The user ID of the user who triggered this event, or null if not available.
object - The object which is related to the event, e.g. the Workflow or Activity instance, or null if not available.
paramNames - A String array of parameter names.
oldValues - A String array of the old values of the parameters.
newValues - A String array of the new values of the parameters.
exception - The exception if event outcome was not GWES.Logger.EventOutcome.SUCCESS, or null if not available.
Throws:
LoggingException - If logging fails.

logEventLevelChecked

protected abstract void logEventLevelChecked(GWESLogger.Event event,
                                             GWESLogger.EventOutcome eventOutcome,
                                             String userID,
                                             Object object,
                                             String[] paramNames,
                                             String[] oldValues,
                                             String[] newValues,
                                             Throwable exception)
                                      throws LoggingException
Log an event. Implement this method in all derived classes.

Parameters:
event - The type of event, refer to GWESLogger.Event.
eventOutcome - The event outcome, refer to GWESLogger.EventOutcome.
userID - The user ID of the user who triggered this event, or null if not available.
object - The object which is related to the event, e.g. the Workflow or Activity instance, or null if not available.
paramNames - A String array of parameter names.
oldValues - A String array of the old values of the parameters.
newValues - A String array of the new values of the parameters.
exception - The exception if event outcome was not GWES.Logger.EventOutcome.SUCCESS, or null if not available.
Throws:
LoggingException - If logging fails.


Copyright © 2005-2011 Fraunhofer FIRST. All Rights Reserved.