org.jlf.log
Class AppLog

java.lang.Object
  |
  +--org.jlf.log.AppLog

public class AppLog
extends java.lang.Object

AppLog wraps the Log class to do application-general logging. It provides a singleton accessor, along with lots of handy class method {static} accessors.

AppLog should be your general application log to write out events of a non-specific nature. You can create additional special-purpose logs (for example, DbLog to log database events) by copying this class and creating your own handy class method accessors.

See Also:
Log

Field Summary
protected static Log singleton
          Provides the class variable for the Singleton pattern, to keep track of the one and only instance of this class.
 
Constructor Summary
protected AppLog()
          Protect the default constructor, this class uses a Singleton pattern.
 
Method Summary
static void criticalError(java.lang.String logString)
          Logs a text string at CRITICAL_ERROR_LEVEL This method provides the implementation for a quick accessor to log a critical error, replacing typical calls to System.err.println().
static void detail(java.lang.String logString)
          Logs a text string at DETAIL_LEVEL
static void error(java.lang.String logString)
          Logs a text string at ERROR_LEVEL This method provides the implementation for a quick accessor to log a critical error, replacing typical calls to System.err.println().
static Log getInstance()
          Returns the singleton instance of this class.
static void info(java.lang.String logString)
          Logs a text string at INFO_LEVEL
static boolean isLoggingEnabledFor(int loggingLevel)
          Passthrough method to quick check if you should bother constructing a log message to log at a particular logging level.
static void logString(java.lang.String logString, int errorLevel)
          Logs a text string at the logging level specified.
static void trace(java.lang.String logString)
          Logs a text string at TRACE_LEVEL
static void warning(java.lang.String logString)
          Logs a text string at WARNING_LEVEL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

singleton

protected static Log singleton
Provides the class variable for the Singleton pattern, to keep track of the one and only instance of this class.

Constructor Detail

AppLog

protected AppLog()
Protect the default constructor, this class uses a Singleton pattern. If you need to access the Singleton instance of the class, DON'T make this public, instead use the getInstance() method!

Method Detail

getInstance

public static Log getInstance()
Returns the singleton instance of this class.


logString

public static void logString(java.lang.String logString,
                             int errorLevel)
Logs a text string at the logging level specified. This method is used when your code needs to parameterize the logging level. Otherwise you probably should use the err(), warning(), info(), detail(), or trace() methods below, they will be less verbose in your code.


criticalError

public static void criticalError(java.lang.String logString)
Logs a text string at CRITICAL_ERROR_LEVEL This method provides the implementation for a quick accessor to log a critical error, replacing typical calls to System.err.println().


error

public static void error(java.lang.String logString)
Logs a text string at ERROR_LEVEL This method provides the implementation for a quick accessor to log a critical error, replacing typical calls to System.err.println().


warning

public static void warning(java.lang.String logString)
Logs a text string at WARNING_LEVEL


info

public static void info(java.lang.String logString)
Logs a text string at INFO_LEVEL


detail

public static void detail(java.lang.String logString)
Logs a text string at DETAIL_LEVEL


trace

public static void trace(java.lang.String logString)
Logs a text string at TRACE_LEVEL


isLoggingEnabledFor

public static boolean isLoggingEnabledFor(int loggingLevel)
Passthrough method to quick check if you should bother constructing a log message to log at a particular logging level.