SmartFrog 3.10.000

org.smartfrog.sfcore.logging
Class LogFactory

java.lang.Object
  extended by org.smartfrog.sfcore.logging.LogFactory

public class LogFactory
extends java.lang.Object

Log Factory


Field Summary
protected static java.util.Hashtable loggers
          hashtable of loggers
 
Constructor Summary
protected LogFactory()
          Protected constructor that is not available for public use.
 
Method Summary
static Log getLog(java.lang.Class clazz)
          Convenience method to return a named logger
static LogSF getLog(Prim prim)
          get a log for a component
static LogSF getLog(Prim prim, boolean registerWithCoreLog)
          Convenience method to derive a name from
static LogSF getLog(java.lang.String name)
          get a named log.
static LogSF getLog(java.lang.String name, boolean registerWithCoreLog)
          Construct (if necessary) and return a Log instance.
static Log getOwnerLog(Prim owner)
          get the log of an owner, or, if that fails, from its classname.
static Log getOwnerLog(Prim owner, java.lang.Class clazz)
          get the log of an owner, or, if that fails, from our classname.
static Log getOwnerLog(Prim owner, java.lang.Object object)
          get the log of an owner, or, if that fails, from our classname.
 void release()
          Release any internal references to previously created Log logs returned by this factory.
static LogSF sfGetProcessLog()
          To get the sfCore logger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

loggers

protected static java.util.Hashtable loggers
hashtable of loggers

Constructor Detail

LogFactory

protected LogFactory()
Protected constructor that is not available for public use.

Method Detail

getLog

public static LogSF getLog(Prim prim)
                    throws SmartFrogLogException
get a log for a component

Parameters:
prim - component
Returns:
a new log.
Throws:
SmartFrogLogException - when something went wrong with getting a log

getLog

public static LogSF getLog(java.lang.String name)
get a named log.

Parameters:
name - log name
Returns:
a log from cache or new.

getLog

public static Log getLog(java.lang.Class clazz)
Convenience method to return a named logger

Parameters:
clazz - Class from which a log name will be derived
Returns:
Log

getLog

public static LogSF getLog(Prim prim,
                           boolean registerWithCoreLog)
                    throws SmartFrogLogException
Convenience method to derive a name from

Parameters:
prim - component to use
registerWithCoreLog - flag to enable registration with the core
Returns:
a log
Throws:
SmartFrogLogException - if the prim name could not be completed, or when registration failed.

getLog

public static LogSF getLog(java.lang.String name,
                           boolean registerWithCoreLog)
                    throws SmartFrogLogException

Construct (if necessary) and return a Log instance.

Parameters:
name - Logical name of the Log instance to be returned (the meaning of this name is only known to the underlying loggers registered with Log )
registerWithCoreLog - flag to enable registration with the core
Returns:
a log
Throws:
SmartFrogLogException - if a suitable Log instance cannot be returned

sfGetProcessLog

public static LogSF sfGetProcessLog()
To get the sfCore logger

Returns:
Logger implementing LogSF and Log

release

public void release()
Release any internal references to previously created Log logs returned by this factory.


getOwnerLog

public static Log getOwnerLog(Prim owner,
                              java.lang.Class clazz)
get the log of an owner, or, if that fails, from our classname. Useful for helper classes that want to log through their owner and dont want lots of error handling in their constructors

Parameters:
owner - component that owns this helper class
clazz - class own classname
Returns:
a log

getOwnerLog

public static Log getOwnerLog(Prim owner,
                              java.lang.Object object)
get the log of an owner, or, if that fails, from our classname. Useful for helper classes that want to log through their owner and dont want lots of error handling in their constructors

Parameters:
owner - component that owns this helper class
object - class to log off
Returns:
a log

getOwnerLog

public static Log getOwnerLog(Prim owner)
get the log of an owner, or, if that fails, from its classname. always returns a log of one form or other

Parameters:
owner - component that owns this helper class
Returns:
a log

SmartFrog CORE 3.10.000

(C) Copyright 1998-2006 Hewlett-Packard Development Company, LP