Project Wonder 5.0

er.extensions.logging
Class ERXLogger

java.lang.Object
  extended by org.apache.log4j.Category
      extended by org.apache.log4j.Logger
          extended by er.extensions.logging.ERXLogger
All Implemented Interfaces:
org.apache.log4j.spi.AppenderAttachable

public class ERXLogger
extends org.apache.log4j.Logger

Custom subclass of Logger. The main reason for this class is to isolate the log4j dependency to only this class. This gives us the freedom in the future to switch logging systems and this should be the only effected class .. in theory.


Nested Class Summary
static class ERXLogger.Factory
          LoggerFactory subclass that creates ERXLogger objects instead of the default Logger classes.
 
Field Summary
static java.lang.String CONFIGURE_LOGGING_WITH_SYSTEM_PROPERTIES
           
static ERXLogger.Factory factory
           
static org.apache.log4j.Logger log
          logging supprt
 
Fields inherited from class org.apache.log4j.Category
additive, level, name, parent, repository, resourceBundle
 
Constructor Summary
ERXLogger(java.lang.String name)
          Default constructor.
 
Method Summary
static void configureLogging(java.util.Properties properties)
          Sets up the logging system with the given configuration in Properties format.
static void configureLoggingWithSystemProperties()
           
 void debugStackTrace(java.lang.Throwable throwable)
          Dumps an Throwable's Stack trace on the appender if debugging is enabled.
static ERXLogger getERXLogger(java.lang.Class clazz)
          Creates a logger for a given class object.
static ERXLogger getERXLogger(java.lang.Class clazz, java.lang.String subTopic)
          Creates a logger for the given class object plus a restricting subtopic.
static ERXLogger getERXLogger(java.lang.String name)
          Main entry point for getting an Logger for a given name.
static org.apache.log4j.Logger getLogger(java.lang.Class clazz)
           
static org.apache.log4j.Logger getLogger(java.lang.String name)
          Overrides method of superclass to return a logger using our custom Logger$Factory class.
 
Methods inherited from class org.apache.log4j.Logger
getLogger, getRootLogger
 
Methods inherited from class org.apache.log4j.Category
addAppender, assertLog, callAppenders, debug, debug, error, error, exists, fatal, fatal, forcedLog, getAdditivity, getAllAppenders, getAppender, getChainedPriority, getCurrentCategories, getDefaultHierarchy, getEffectiveLevel, getHierarchy, getInstance, getInstance, getLevel, getLoggerRepository, getName, getParent, getPriority, getResourceBundle, getResourceBundleString, getRoot, info, info, isAttached, isDebugEnabled, isEnabledFor, isInfoEnabled, l7dlog, l7dlog, log, log, log, removeAllAppenders, removeAppender, removeAppender, setAdditivity, setLevel, setPriority, setResourceBundle, shutdown, warn, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIGURE_LOGGING_WITH_SYSTEM_PROPERTIES

public static final java.lang.String CONFIGURE_LOGGING_WITH_SYSTEM_PROPERTIES
See Also:
Constant Field Values

log

public static org.apache.log4j.Logger log
logging supprt


factory

public static ERXLogger.Factory factory
Constructor Detail

ERXLogger

public ERXLogger(java.lang.String name)
Default constructor. Constructs a logger for the given name.

Parameters:
name - of the logging logger
Method Detail

getERXLogger

public static ERXLogger getERXLogger(java.lang.String name)
Main entry point for getting an Logger for a given name. Calls getLogger to return the instance of Logger from our custom Factory. Note that if the log4j system has not been setup correctly, meaning the LoggerFactory subclass has not been correctly put in place, then RuntimeException will be thrown.

Parameters:
name - to create the logger for
Returns:
Logger for the given name.

getLogger

public static org.apache.log4j.Logger getLogger(java.lang.String name)
Overrides method of superclass to return a logger using our custom Logger$Factory class. This works identical to log4.Logger.getLogger

Parameters:
name - to create the logger for
Returns:
Logger for the given name.

getERXLogger

public static ERXLogger getERXLogger(java.lang.Class clazz)
Creates a logger for a given class object. Gets a logger for the fully qualified class name of the given class.

Parameters:
clazz - Class object to create the logger for
Returns:
logger for the given class name

getLogger

public static org.apache.log4j.Logger getLogger(java.lang.Class clazz)

getERXLogger

public static ERXLogger getERXLogger(java.lang.Class clazz,
                                     java.lang.String subTopic)
Creates a logger for the given class object plus a restricting subtopic. For instance if you had the class a.b.Foo and you wanted to create a logger for the subtopic 'utilities' for the class Foo then the created logging logger would have the path: a.b.Foo.utilities.

Parameters:
clazz - Class object to create the logger for
subTopic - to restrict the current logger to
Returns:
logger for the given class and subtopic

configureLoggingWithSystemProperties

public static void configureLoggingWithSystemProperties()

configureLogging

public static void configureLogging(java.util.Properties properties)
Sets up the logging system with the given configuration in Properties format.

Parameters:
properties - with the logging configuration

debugStackTrace

public void debugStackTrace(java.lang.Throwable throwable)
Dumps an Throwable's Stack trace on the appender if debugging is enabled.

Parameters:
throwable - throwable to dump

Last updated: Tue, Feb 21, 2017 • 05:45 PM CET

Copyright © 2002 – 2007 Project Wonder.