marf.util
Class Debug

java.lang.Object
  extended by java.lang.Thread
      extended by marf.util.BaseThread
          extended by marf.util.Logger
              extended by marf.util.Debug
All Implemented Interfaces:
java.lang.Runnable

public class Debug
extends Logger

Simple MARF Debugging Facility.

$Id: Debug.java,v 1.18 2007/12/23 06:29:46 mokhov Exp $

Since:
0.3.0.2
Version:
$Revision: 1.18 $
Author:
Serguei Mokhov

Nested Class Summary
 
Nested classes/interfaces inherited from class marf.util.Logger
Logger.LogPrintStream
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
static java.lang.String DEFAULT_DEBUG_LOG_FILENAME
          Default filename to log the debug output to.
static boolean sbDebugOn
          Public debug flag.
 
Fields inherited from class marf.util.Logger
bAvailable, bNoTimestamp, iLogDirection, LOG_STDERR_TO_FILE, LOG_STDOUT_STDERR_TO_FILE, LOG_STDOUT_TO_FILE, LOG_TO_FILE_STDOUT_STDERR, oLog, strFilename, strLogMessage
 
Fields inherited from class marf.util.BaseThread
iTID, oTarget, siNextTID
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected Debug()
          Needed for logger.
 
Method Summary
static void debug()
          Issues an empty debug message if the flag is on with a trailing EOL.
static void debug(java.lang.Class poClass, java.lang.Object poMsgObject)
          Issues a debug message if the flag is on with a trailing EOL preceded by the class name.
static void debug(java.lang.Class poClass, java.lang.String pstrMsgString)
          Issues a debug message if the flag is on with a trailing EOL preceded by the class name.
static void debug(java.lang.Object poObject)
          Issues a debug message if the flag is on with a trailing EOL by calling toString() of the parameter.
static void debug(java.lang.String pstrMsgString)
          Issues a debug message if the flag is on with a trailing EOL.
static void debug(java.lang.String pstrMsgString, boolean pbEOLNeeded)
          Issues a debug message if the flag is on.
static boolean enableDebug()
          Enables debugging.
static boolean enableDebug(boolean pbEnable)
          Enables or disables debugging based on the parameter.
static java.lang.String getMARFSourceCodeRevision()
          Retrieves class' revision.
static boolean isDebugOn()
          Allows to atomically query the debug flag.
 
Methods inherited from class marf.util.Logger
enableTimestamp, getLogDirection, getLogFilename, getLogPrintStream, isTimestampEnabled, setLogDirection, setLogFilename, setLogPrintStream
 
Methods inherited from class marf.util.BaseThread
getNextTID, getTarget, getTID
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_DEBUG_LOG_FILENAME

public static final java.lang.String DEFAULT_DEBUG_LOG_FILENAME
Default filename to log the debug output to.

Since:
0.3.0.4
See Also:
Constant Field Values

sbDebugOn

public static boolean sbDebugOn
Public debug flag. Notice, multithreaded clients must synchronized on this themselves if they use the flag directly.

Constructor Detail

Debug

protected Debug()
         throws java.lang.Exception
Needed for logger. Sets the default filename to debug.log

Throws:
java.lang.Exception - if parent does
Method Detail

enableDebug

public static final boolean enableDebug(boolean pbEnable)
Enables or disables debugging based on the parameter. This method is properly synchronized.

Parameters:
pbEnable - to set the debug flag to
Returns:
old value of the debug flag

enableDebug

public static final boolean enableDebug()
Enables debugging. This method is properly synchronized.

Returns:
old value of the debug flag

isDebugOn

public static final boolean isDebugOn()
Allows to atomically query the debug flag.

Returns:
the current state of the debug flag
Since:
0.3.0.4

debug

public static final void debug(java.lang.String pstrMsgString,
                               boolean pbEOLNeeded)
Issues a debug message if the flag is on. The message can have the trailing EOL or not based on the 2nd argument. This method is properly synchronized.

Parameters:
pstrMsgString - desired debug message to be issued
pbEOLNeeded - true if the trailing EOL is desired.

debug

public static final void debug(java.lang.String pstrMsgString)
Issues a debug message if the flag is on with a trailing EOL. This method is properly synchronized.

Parameters:
pstrMsgString - desired debug message to be issued

debug

public static final void debug(java.lang.Object poObject)
Issues a debug message if the flag is on with a trailing EOL by calling toString() of the parameter. This method is properly synchronized.

Parameters:
poObject - object to dump to the debug output
Since:
0.3.0.3

debug

public static final void debug(java.lang.Class poClass,
                               java.lang.String pstrMsgString)
Issues a debug message if the flag is on with a trailing EOL preceded by the class name. This method is properly synchronized.

Parameters:
poClass - add class to extract the name from as a prefix
pstrMsgString - desired debug message to be issued

debug

public static final void debug(java.lang.Class poClass,
                               java.lang.Object poMsgObject)
Issues a debug message if the flag is on with a trailing EOL preceded by the class name. This method is properly synchronized.

Parameters:
poClass - add class to extract the name from as a prefix
poMsgObject - the object, whose string representation to be used as message
Since:
0.3.0.6

debug

public static final void debug()
Issues an empty debug message if the flag is on with a trailing EOL. This method is properly synchronized.


getMARFSourceCodeRevision

public static java.lang.String getMARFSourceCodeRevision()
Retrieves class' revision.

Returns:
revision string


SourceForge Logo