net.sf.joost
Class OptionalLog

java.lang.Object
  extended by net.sf.joost.OptionalLog

public final class OptionalLog
extends Object

Provides a helper class that optionally initializes the Commons Logging facility. If org.apache.commons.logging.LogFactory is present the getLog(Class) method returns a normal Log object that must be converted (via a type cast) before using it. Otherwise the method returns null. This approach prevents a NoClassDefFoundError in case logging is not available.

Version:
$Revision: 1.3 $ $Date: 2004/11/06 13:08:51 $
Author:
Oliver Becker

Field Summary
private static Method getLogMethodClass
           
private static Method getLogMethodString
           
 
Constructor Summary
OptionalLog()
           
 
Method Summary
static org.apache.commons.logging.Log getLog(Class _class)
          Returns a org.apache.commons.logging.Log object if this class is available, otherwise null
static org.apache.commons.logging.Log getLog(String name)
          Returns a org.apache.commons.logging.Log object if this class is available, otherwise null
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

getLogMethodClass

private static Method getLogMethodClass

getLogMethodString

private static Method getLogMethodString
Constructor Detail

OptionalLog

public OptionalLog()
Method Detail

getLog

public static org.apache.commons.logging.Log getLog(Class _class)
Returns a org.apache.commons.logging.Log object if this class is available, otherwise null


getLog

public static org.apache.commons.logging.Log getLog(String name)
Returns a org.apache.commons.logging.Log object if this class is available, otherwise null