|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.aspsimon.cdlib.core.LogUtils
public class LogUtils
LogUtils is a utility class for logging functionality. CDLib's logging is controlled by binary switches, meaning that the basic functionality of a "normal" logging class like log4j is not quite sufficient. Loglevels are set in the configuration file, which is read at startup of the application.
The loglevels are defined as follows:
This means that to activate all logging to the console, the user could set the cdlib.loglevel property to 63 (32+16+8+4+2+1). To log everything to the logfile, set it to 31. To only log network traffic and warning messages, but not exception stacktraces, informational messages or function entry and exit points, the value would be set to 2+8 = 10.
| Method Summary | |
|---|---|
void |
closeLog()
close the log file gracefully. |
boolean |
evaluateLogging(int checkLevel)
Check if logging for the given level is activated. |
static LogUtils |
getInstance()
|
void |
logError(java.lang.Exception e)
Log stack trace to the logfile |
void |
logError(java.lang.Exception e,
java.lang.String msg)
Log a message and the stack trace to the logfile |
void |
logFunction(java.lang.String msg,
boolean entry)
Log function entry and exit points. |
void |
logInfo(java.lang.String msg)
Log informational messages |
void |
logNetwork(java.lang.String msg,
boolean outgoing)
Log network traffic sent in and out |
void |
logWarn(java.lang.String msg)
Log warning messages |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static LogUtils getInstance()
public boolean evaluateLogging(int checkLevel)
checkLevel - the loglevel to be checked.
public void logFunction(java.lang.String msg,
boolean entry)
msg - What to logentry - true for entry and false for exit.
public void logNetwork(java.lang.String msg,
boolean outgoing)
msg - What to logoutgoing - true for outgoing traffic, false for incoming.public void logInfo(java.lang.String msg)
msg - What to logpublic void logWarn(java.lang.String msg)
msg - What to logpublic void logError(java.lang.Exception e)
e - Exception to logException
public void logError(java.lang.Exception e,
java.lang.String msg)
e - Exception to logmsg - Informational messageExceptionpublic void closeLog()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||