|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.objectwave.logging.MessageLog
This class provides an abstraction to any logging system. For example,
Log4J or the Logging API put forth to the Java Community Process. The
class works in much the same way that other "pluggable" APIs work, i.e.
the MessageLog class is merely a skeleton class that has a "peer" that
performs the real logging work. The MessageLog class manages that
peer and delegates method calls to that peer.
How do I set the peer?
The requirement for the peer classes is limited to one : The Peer class
must implement the com.objectwave.logging.LogIF interface.
What is the default peer?
The default peer is the com.objectwave.logging.log4j.Log4jImpl class. This
class delegates the the Apache Log4J Logging system.
If log4j is not
found in the classpath, then the ConsoleImpl is used.
So how do I use this class
In it's most simplistic form, simply call :
com.objectwave.logging.MessageLog.info(this, "My Message");
A note about Message Levels (or ranks)
different ranks that allow logging thresholds to be specified.
debug - This level will almost always be disabled during production. This is
the lowest message level.
info - Another low level, but a step above debug. Use this to convey
information about the progress of the application. If these messages are not
seen, its no big deal.
warn - A setp above info - Will likely be enabled for a production
application. Warn level messages report that something odd happened, but not
odd enough to necessarily require any immediate action. The odd behavior may
actually be expected, just that the module generating the warn message
doesn't know enough to make that judgement call.
error - The most severe. The application module has decided that something
terrible has happen. Its probably best to begin shutting down the
application.
Field Summary | |
static boolean |
showBootstrapLogMessages
This flag determines whether or not bootstrap messages should be logged, or shown. |
static java.lang.ThreadLocal |
traceHolder
This maintains the traces on a per thread basis. |
Constructor Summary | |
MessageLog()
|
Method Summary | |
static void |
debug(java.lang.Object source,
java.lang.String message)
Display information helpful for debugging applications. |
static void |
debug(java.lang.Object source,
java.lang.String message,
java.lang.Throwable cause)
Display information helpful for debugging applications. |
static void |
error(java.lang.Object source,
java.lang.String message,
java.lang.Throwable cause)
There is has been an error. |
static LogIF |
getLoggingEngine()
This method returns the LogIF peer class for the MessageLog. |
static void |
info(java.lang.Object source,
java.lang.String message)
Informational messages. |
static boolean |
isDebugEnabled(java.lang.Object source)
isDebugEnabled for the given source. |
static void |
setLoggingEngine(LogIF engine)
Allow any application to plug in their own implementation. |
static void |
track(java.lang.String categoryName,
java.lang.Runnable codeBlock)
Run the provided code block and decorate any resulting log messages with specified category. |
static void |
track(java.lang.String categoryName,
Trace codeBlock)
Run the provided code block and decorate any resulting log messages with specified category. |
static void |
warn(java.lang.Object source,
java.lang.String message)
Warning messages. |
static void |
warn(java.lang.Object source,
java.lang.String message,
java.lang.Throwable cause)
Warning messages. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static boolean showBootstrapLogMessages
public static java.lang.ThreadLocal traceHolder
Constructor Detail |
public MessageLog()
Method Detail |
public static final void setLoggingEngine(LogIF engine)
engine
- The new LoggingEngine valueConsoleImpl
public static boolean isDebugEnabled(java.lang.Object source)
source
- An object or String category
public static final LogIF getLoggingEngine()
public static void info(java.lang.Object source, java.lang.String message)
source
- An object that will provide context to the message being
logged.message
- public static void warn(java.lang.Object source, java.lang.String message, java.lang.Throwable cause)
source
- An object that will provide context to the message being
logged.message
- cause
- public static void warn(java.lang.Object source, java.lang.String message)
source
- An object that will provide context to the message being
logged.message
- public static void debug(java.lang.Object source, java.lang.String message)
source
- An object that will provide context to the message being
logged.message
- public static void debug(java.lang.Object source, java.lang.String message, java.lang.Throwable cause)
source
- An object that will provide context to the message being
logged.message
- cause
- public static void error(java.lang.Object source, java.lang.String message, java.lang.Throwable cause)
source
- An object that will provide context to the message being
logged.message
- cause
- public static void track(java.lang.String categoryName, Trace codeBlock) throws java.lang.Exception
categoryName
- The 'tracking' name that will be used to follow the call path.codeBlock
- The code to execute.
java.lang.Exception
- Any exception could occur while running code!public static void track(java.lang.String categoryName, java.lang.Runnable codeBlock)
categoryName
- The 'tracking' name that will be used to follow the call path.codeBlock
- The code to execute.track(String,Trace)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |