com.objectwave.logging.log4j
Class Log4jImpl

java.lang.Object
  |
  +--com.objectwave.logging.log4j.Log4jImpl
All Implemented Interfaces:
LogIF

public class Log4jImpl
extends java.lang.Object
implements LogIF

The concrete implmentation of the LogIF that uses the Log4j logging classes.

Version:
$Id: Log4jImpl.java,v 2.4 2002/07/31 15:55:22 dave_hoag Exp $
Author:
Dave Hoag

Nested Class Summary
static class Log4jImpl.Test
           
 
Field Summary
protected  java.lang.ThreadLocal traceHolder
           
 
Constructor Summary
Log4jImpl()
           
 
Method Summary
protected  boolean alreadyConfigured()
           
 void debug(java.lang.Object source, java.lang.String message)
           
 void debug(java.lang.Object source, java.lang.String message, java.lang.Throwable cause)
           
 void error(java.lang.Object source, java.lang.String message, java.lang.Throwable cause)
           
protected  java.lang.String formatCategory(java.lang.String defaultCategory)
          Decorate the text with any tracing information.
protected  java.lang.String getCategoryId(java.lang.Object source)
          Categories are identified by the package name of the object.
protected  java.lang.String getPackageName(java.lang.String className)
          Get the 'package name' from the class full name.
 void info(java.lang.Object source, java.lang.String message)
           
protected  void initialize()
           
 boolean isDebugEnabled(java.lang.Object source)
          isDebugEnabled for the given source.
 void track(java.lang.String categoryName, Trace codeBlock)
          Run the provided code block and decorate any resulting log messages with specified category.
 void warn(java.lang.Object source, java.lang.String message)
           
 void warn(java.lang.Object source, java.lang.String message, java.lang.Throwable cause)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

traceHolder

protected java.lang.ThreadLocal traceHolder
Constructor Detail

Log4jImpl

public Log4jImpl()
Method Detail

isDebugEnabled

public boolean isDebugEnabled(java.lang.Object source)
isDebugEnabled for the given source.

Specified by:
isDebugEnabled in interface LogIF
Parameters:
source -
Returns:
The DebugEnabled value

getCategoryId

protected java.lang.String getCategoryId(java.lang.Object source)
Categories are identified by the package name of the object.

Parameters:
source -
Returns:
The CategoryId value

getPackageName

protected java.lang.String getPackageName(java.lang.String className)
Get the 'package name' from the class full name.

Parameters:
className -
Returns:
String of containing just the package name of the class.

track

public void track(java.lang.String categoryName,
                  Trace codeBlock)
           throws java.lang.Exception
Run the provided code block and decorate any resulting log messages with specified category.

Specified by:
track in interface LogIF
Parameters:
categoryName - The 'tracking' name that will be used to follow the call path.
codeBlock - The code to execute.
Throws:
java.lang.Exception - Any exception could occur while running code!

formatCategory

protected java.lang.String formatCategory(java.lang.String defaultCategory)
Decorate the text with any tracing information.

Parameters:
defaultCategory -
Returns:

info

public void info(java.lang.Object source,
                 java.lang.String message)
Specified by:
info in interface LogIF
Parameters:
source -
message -

warn

public void warn(java.lang.Object source,
                 java.lang.String message)
Specified by:
warn in interface LogIF
Parameters:
source -
message -

warn

public void warn(java.lang.Object source,
                 java.lang.String message,
                 java.lang.Throwable cause)
Specified by:
warn in interface LogIF
Parameters:
source -
message -
cause -

debug

public void debug(java.lang.Object source,
                  java.lang.String message)
Specified by:
debug in interface LogIF
Parameters:
source -
message -

debug

public void debug(java.lang.Object source,
                  java.lang.String message,
                  java.lang.Throwable cause)
Specified by:
debug in interface LogIF
Parameters:
source -
message -
cause -

error

public void error(java.lang.Object source,
                  java.lang.String message,
                  java.lang.Throwable cause)
Specified by:
error in interface LogIF
Parameters:
source -
message -
cause -

alreadyConfigured

protected boolean alreadyConfigured()
Returns:

initialize

protected void initialize()