|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jlf.log.AbstractLoggingMechanism
AbstractLoggingMechanism is an abstract class which serves to define a hierarchy of different logging mechanisms. Subclasses of this class will implement the different mechanisms defined herein. The main responsibility of this class hierarchy is to offload the implementation work for differences in logging streams for different mechanisms. For example, the standard error stream is a very different implementation than a shared local output file.
Field Summary | |
protected static java.text.SimpleDateFormat |
compactDateFormat
|
protected static java.text.DateFormat |
dateFormat
|
protected java.util.Date |
dateOpened
The date the mechanism was first opened. |
protected java.util.Vector |
logs
|
protected java.io.PrintWriter |
printStream
|
protected static java.text.SimpleDateFormat |
timeFormat
|
Constructor Summary | |
AbstractLoggingMechanism()
|
Method Summary | |
protected void |
close()
This method closes the particular logging mechanism so that messages no longer get logged to the mechanism. |
protected void |
closeForLog(Log log)
Logs call this method to deregister themselves with the mechanism. |
protected java.lang.String |
compactCurrentDate()
|
protected java.lang.String |
currentDate()
|
protected java.lang.String |
currentTime()
|
protected static AbstractLoggingMechanism |
getLoggingMechanismForString(java.lang.String mechanismString)
|
java.lang.String |
getName()
Return the name of the mechanism. |
protected boolean |
hasDateRolledOver()
Checks the current date verses the date the log was opened. |
protected boolean |
isDatedLog()
Mechanisms can be dated or non-dated. |
protected boolean |
isSharedLog()
Mechanisms can be shared or unique. |
protected java.lang.String |
loggingPrefix(Log log,
int loggingLevel)
Returns a string which is to be concatenated before the log message, so that the log message can be properly understood in the context of other messages and logs (if a shared log). |
protected void |
logString(Log log,
int loggingLevel,
java.lang.String logString)
Logs a string to printStream, complete with a descriptive prefix so viewers of the log can interpret who logged which strings and how important they were. |
protected void |
notifyLogClosed(Log log)
|
protected void |
notifyLoggingLevelChange(Log log,
int loggingLevel)
|
protected void |
notifyLogOpened(Log log,
int loggingLevel)
|
protected void |
open(Log log)
This method opens the particular logging mechanism so that messages can be output to the printSteam instance variable. |
protected void |
openForLog(Log log,
int loggingLevel)
Logs call this method to register themselves with the mechanism. |
protected void |
rollLogOver()
Rolls a log over, typically on a date change, by closing the log and re-opening it. |
java.lang.String |
toString()
Return a nice debug string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.io.PrintWriter printStream
protected java.util.Date dateOpened
protected java.util.Vector logs
protected static java.text.SimpleDateFormat timeFormat
protected static java.text.SimpleDateFormat compactDateFormat
protected static java.text.DateFormat dateFormat
Constructor Detail |
public AbstractLoggingMechanism()
Method Detail |
protected java.lang.String currentDate()
protected java.lang.String compactCurrentDate()
protected java.lang.String currentTime()
protected boolean isDatedLog()
protected boolean isSharedLog()
protected java.lang.String loggingPrefix(Log log, int loggingLevel)
The format is [loggingLevel]|[time]| where [loggingLevel] is the integer logging level the msg was logged at [time] is the local time in SHORT DateFormat
protected void open(Log log)
protected void close()
protected void notifyLogOpened(Log log, int loggingLevel)
protected void notifyLogClosed(Log log)
protected void notifyLoggingLevelChange(Log log, int loggingLevel)
protected void openForLog(Log log, int loggingLevel)
protected void closeForLog(Log log)
protected boolean hasDateRolledOver()
protected void rollLogOver()
protected void logString(Log log, int loggingLevel, java.lang.String logString)
protected static AbstractLoggingMechanism getLoggingMechanismForString(java.lang.String mechanismString) throws java.lang.Exception
java.lang.Exception
public java.lang.String getName()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |