|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectca.bc.webarts.tools.Log
A Simple Log class that can be set to output to a file, the Console or any specified OutputStream. It provides a few simple log entry methods with method entry/exit tracking.
Field Summary | |
private static java.util.Calendar |
calendar_
Description of the Field |
static short |
CONSOLE
Constant Specifying that the logging output will go to System.out. |
private static java.util.Stack |
currentMethod_
A stack of the method call history. |
static short |
DEBUG
Constant Specifying Major Minor and Debug Log events logging will occur. |
static short |
FILE
Constant Specifying that the logging output will go to a spec'd file. |
static short |
FULL
Constant Specifying ALL log event logging will occur. |
private static boolean |
instantiated_
|
private static Log |
log_
|
private static java.io.File |
logFile_
Description of the Field |
private static java.lang.String |
logFileName_
Description of the Field |
private static java.io.FileWriter |
logFileWriter_
Description of the Field |
private static short |
logLevel_
Description of the Field |
private static java.io.PrintStream |
logOut_
The stream that ALL logging ends upo getting directed to. |
static short |
MAJOR
Constant Specifying only Major Log events logging will occur. |
static short |
MINOR
Constant Specifying Major and Minor Log events logging will occur. |
private static java.lang.String |
msgSpacing_
Description of the Field |
static short |
NONE
Constant Specifying NO logging will occur. |
private static short |
outSpot_
Description of the Field |
static short |
PIPE
Constant Specifying that the logging output will go to a spec'd OutputStream. |
static short |
QUIET
Constant Specifying minimal logging will occur (only Method entry and exit). |
private static java.io.PrintStream |
STD_OUT
The Standard OutputStream. |
private static java.io.OutputStream |
userOut_
Description of the Field |
Constructor Summary | |
private |
Log()
Default Constructor for the Log object. |
private |
Log(short logLevel)
Constructor for the Log object that sends the output to the Console at the specified Log Level. |
private |
Log(short logLevel,
java.io.File logFile)
Constructor for the Log object that sends the output to a File at the specified Log Level. |
private |
Log(short logLevel,
java.io.OutputStream o)
Constructor for the Log object that sends the output to an OutputStream Pipe at the specified Log Level. |
private |
Log(short logLevel,
java.lang.String logName)
Constructor for the Log object that sends the output to a File with the spec'd filename at the specified Log Level. |
Method Summary | |
static boolean |
alreadyInstantiated()
|
static void |
close()
Cleanup method that closes any open Files. |
static java.lang.String |
createCurrentTimeStamp()
Creates a timestamp for the current time in the form of 'hour + "-" + min + "-" + sec + "-" + millis'. |
static Log |
createLog(short logLevel)
Singleton method to get the log instance going to stdout. |
static Log |
createLog(short logLevel,
java.io.File logFile)
Singleton method to get the log instance going to a File. |
static Log |
createLog(short logLevel,
java.io.OutputStream stream)
Singleton method to get the log instance going to an OutputStream. |
static Log |
createLog(short logLevel,
java.lang.String fName)
Singleton method to get the log instance going to a File. |
static void |
debug(java.lang.String value)
Logs a Debug level message prefixed with the current methodname. |
static void |
debug(java.lang.String methodName,
java.lang.String value)
Logs a Debug level message prefixed with the spec'd methodname. |
static void |
endMethod()
Logs the exit from the last entered method with a simple log message. |
static void |
endMethod(java.lang.String methodName)
Logs the exit from a method with a simple log message. |
private static java.lang.String |
getCurrentMethodName()
Generic uncategorized log entry. |
static Log |
getInstance()
Singleton method to get the log instance NULL if not init yet with a createLog call. |
static short |
getLogLevel()
|
static java.lang.String |
getLogLevelString()
|
private static void |
initLogOut()
Initializes the logOut_ Stream based on the outSpot specifired by the user. |
private static void |
logEntry(java.lang.String value)
Generic uncategorized log entry. |
private static void |
logEntry(java.lang.String value,
java.lang.Exception ex)
Generic uncategorized log entry. |
private static void |
logEntry(java.lang.String methodName,
java.lang.String value)
A log entry method |
static void |
major(java.lang.String value)
Logs a Major level message prefixed with the current methodname. |
static void |
major(java.lang.String value,
java.lang.Exception ex)
Logs a Major level message prefixed with the current methodname. |
static void |
major(java.lang.String methodName,
java.lang.String value)
Logs a Major Log event with the spec'd method name prefix. |
static void |
minor(java.lang.String value)
Logs a minor level message prefixed with the current methodname. |
static void |
minor(java.lang.String value,
java.lang.Exception ex)
Logs a minor level message prefixed with the current methodname. |
static void |
minor(java.lang.String methodName,
java.lang.String value)
Logs a Minor level message prefixed with the spec'd methodname. |
static boolean |
setLogFile(java.io.File logFile)
Sets the logFile_ attribute to the spec'd File. |
static boolean |
setLogFile(java.lang.String fName)
Creates a File object based on the spec'd filename and then inits the logFile_ attribute. |
static boolean |
setLogLevel(short level)
Sets the current Logging Level. |
static void |
startMethod(java.lang.String methodName)
Logs an entry into a method with a simple log message. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static boolean instantiated_
private static Log log_
public static final short NONE
public static final short QUIET
public static final short MAJOR
public static final short MINOR
public static final short DEBUG
public static final short FULL
public static final short CONSOLE
public static final short FILE
public static final short PIPE
private static final java.io.PrintStream STD_OUT
private static java.lang.String logFileName_
private static java.lang.String msgSpacing_
private static java.io.OutputStream userOut_
private static java.io.PrintStream logOut_
private static java.io.File logFile_
private static java.io.FileWriter logFileWriter_
private static short logLevel_
private static short outSpot_
private static java.util.Calendar calendar_
private static java.util.Stack currentMethod_
Constructor Detail |
private Log()
private Log(short logLevel)
logLevel
- The desired Logging level (must be one of the Constants
spec'd in this class).private Log(short logLevel, java.io.OutputStream o)
logLevel
- The desired Logging level (must be one of the Constants
spec'd in this class).o
- The OutputStream to Pipe the logging to.private Log(short logLevel, java.io.File logFile)
logLevel
- The desired Logging level (must be one of the Constants
spec'd in this class).logFile
- The File to send the Logging to.private Log(short logLevel, java.lang.String logName)
logLevel
- The desired Logging level (must be one of the Constants
spec'd in this class).logName
- The filename for the File to send Logging output to.Method Detail |
public static Log createLog(short logLevel, java.io.File logFile)
public static Log createLog(short logLevel, java.io.OutputStream stream)
public static Log createLog(short logLevel, java.lang.String fName)
public static Log createLog(short logLevel)
public static Log getInstance()
public static boolean alreadyInstantiated()
public static boolean setLogLevel(short level)
public static short getLogLevel()
public static java.lang.String getLogLevelString()
public static boolean setLogFile(java.lang.String fName)
fName
- The filename to use for the new logFile_.
public static boolean setLogFile(java.io.File logFile)
logFile
- The File object to setr to the logFile_.
public static java.lang.String createCurrentTimeStamp()
public static void close()
private static java.lang.String getCurrentMethodName()
private static void logEntry(java.lang.String value)
value
- The String to dump into the Log.private static void logEntry(java.lang.String value, java.lang.Exception ex)
value
- The String to dump into the Log.private static void logEntry(java.lang.String methodName, java.lang.String value)
methodName
- Description of Parametervalue
- The String to dump into the Log.public static void startMethod(java.lang.String methodName)
methodName
- The method being entered.public static void endMethod(java.lang.String methodName)
methodName
- The method being exited.public static void endMethod()
public static void major(java.lang.String methodName, java.lang.String value)
methodName
- The methodname to prefix the log message with.value
- The String to dump into the Log.public static void minor(java.lang.String methodName, java.lang.String value)
methodName
- The methodname to prefix the log message with.value
- The String to dump into the Log.public static void debug(java.lang.String methodName, java.lang.String value)
methodName
- The methodname to prefix the log message with.value
- The String to dump into the Log.public static void debug(java.lang.String value)
value
- The String to dump into the Log.public static void major(java.lang.String value)
value
- The String to dump into the Log.public static void major(java.lang.String value, java.lang.Exception ex)
value
- The String to dump into the Log.ex
- An exception that will dump its stacktrace into the log.public static void minor(java.lang.String value)
value
- The String to dump into the Log.public static void minor(java.lang.String value, java.lang.Exception ex)
value
- The String to dump into the Log.ex
- An exception that will dump its stacktrace into the log.private static void initLogOut()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |