public class Log extends Object
Modifier and Type | Field and Description |
---|---|
private static Calendar |
calendar_
Description of the Field
|
static short |
CONSOLE
Constant Specifying that the logging output will go to System.out.
|
private static 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 File |
logFile_
Description of the Field
|
private static String |
logFileName_
The name of the current log file.
|
private static FileWriter |
logFileWriter_
Description of the Field
|
private static short |
logLevel_
Description of the Field
|
private static PrintStream |
logOut_
The stream that ALL logging ends up 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 String |
msgSpacing_
Class field that is used to pad the log messages based on the level of the method being logged.
|
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 PrintStream |
STD_OUT
The Standard OutputStream goes to System.out.
|
private static OutputStream |
userOut_
Class field used for the PIPed output stream being used.
|
Modifier | Constructor and Description |
---|---|
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,
File logFile)
Constructor for the Log object that sends the output to a File
at the specified Log Level.
|
private |
Log(short logLevel,
OutputStream o)
Constructor for the Log object that sends the output to an OutputStream
Pipe at the specified Log Level.
|
private |
Log(short logLevel,
String logName)
Constructor for the Log object that sends the output to a File with the
spec'd filename at the specified Log Level.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
alreadyInstantiated() |
static void |
close()
Cleanup method that closes any open Files.
|
static 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,
File logFile)
Singleton method to get the log instance going to a File.
|
static Log |
createLog(short logLevel,
OutputStream stream)
Singleton method to get the log instance going to an OutputStream.
|
static Log |
createLog(short logLevel,
String fName)
Singleton method to get the log instance going to a File.
|
static void |
debug(String value)
Logs a Debug level message prefixed with the current methodname.
|
static void |
debug(String methodName,
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(String methodName)
Logs the exit from a method with a simple log message.
|
static String |
findCurrentClassName()
Returns the calling classes name by going through the Stacktrace.
|
static String |
findCurrentMethodName()
Returns the calling methods name by going through the Stacktrace.
|
private static 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 String |
getLogLevelString() |
private static void |
initLogOut()
Initializes the logOut_ Stream based on the outSpot specifired by the user.
|
private static void |
logEntry(String value)
Generic uncategorized log entry.
|
private static void |
logEntry(String value,
Exception ex)
Generic uncategorized log entry.
|
private static void |
logEntry(String methodName,
String value)
A log entry method
|
static void |
major(String value)
Logs a Major level message prefixed with the current methodname.
|
static void |
major(String value,
Exception ex)
Logs a Major level message prefixed with the current methodname.
|
static void |
major(String methodName,
String value)
Logs a Major Log event with the spec'd method name prefix.
|
static void |
minor(String value)
Logs a minor level message prefixed with the current methodname.
|
static void |
minor(String value,
Exception ex)
Logs a minor level message prefixed with the current methodname.
|
static void |
minor(String methodName,
String value)
Logs a Minor level message prefixed with the spec'd methodname.
|
static boolean |
setLogFile(File logFile)
Sets the logFile_ attribute to the spec'd File.
|
static boolean |
setLogFile(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()
Logs an entry into a method with a simple log message.
|
static void |
startMethod(String methodName)
Logs an entry into a method with a simple log message.
|
private static boolean instantiated_
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 PrintStream STD_OUT
private static String logFileName_
private static String msgSpacing_
private static OutputStream userOut_
private static PrintStream logOut_
private static FileWriter logFileWriter_
private static short logLevel_
private static short outSpot_
private static Stack currentMethod_
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, 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, 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, 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.public static Log createLog(short logLevel, File logFile)
public static Log createLog(short logLevel, OutputStream stream)
public static Log createLog(short logLevel, 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 String getLogLevelString()
public static boolean setLogFile(String fName)
fName
- The filename to use for the new logFile_.public static boolean setLogFile(File logFile)
logFile
- The File object to setr to the logFile_.public static String createCurrentTimeStamp()
public static void close()
private static void logEntry(String value)
value
- The String to dump into the Log.private static void logEntry(String value, Exception ex)
value
- The String to dump into the Log.private static void logEntry(String methodName, String value)
methodName
- Description of Parametervalue
- The String to dump into the Log.public static String findCurrentClassName()
public static String findCurrentMethodName()
private static String getCurrentMethodName()
value
- The String to dump into the Log.public static void startMethod()
methodName
- The method being entered.public static void startMethod(String methodName)
methodName
- The method being entered.public static void endMethod(String methodName)
methodName
- The method being exited.public static void endMethod()
public static void major(String methodName, String value)
methodName
- The methodname to prefix the log message with.value
- The String to dump into the Log.public static void minor(String methodName, String value)
methodName
- The methodname to prefix the log message with.value
- The String to dump into the Log.public static void debug(String methodName, String value)
methodName
- The methodname to prefix the log message with.value
- The String to dump into the Log.public static void debug(String value)
value
- The String to dump into the Log.public static void major(String value)
value
- The String to dump into the Log.public static void major(String value, 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(String value)
value
- The String to dump into the Log.public static void minor(String value, 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()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses