© 2002 - Lorne Brinkman
www.TheObjectGuy.com
Lorne@TheObjectGuy.com

com.bitfactoryinc.logging
Class InsistentLogger

java.lang.Object
  |
  +--com.bitfactoryinc.logging.Logger
        |
        +--com.bitfactoryinc.logging.InsistentLogger

public class InsistentLogger
extends Logger
implements java.lang.Runnable

Wrap instances of this class around any other logger. If the wrapped logger fails to successfully log an entry, then this instance will keep trying to log the entry. example: Logger myLogger = new SerialSocketLogger("localhost", 12345); // set any desired filters or formatters for myLogger // then wrap in an InsistentLogger... myLogger = new InsistentLogger(myLogger,200,60); // now myLogger can be used like any other logger, but with more // reliability in entries reaching their destination


Field Summary
private  int intervalSeconds
           
private  Logger logger
           
private  MemoryLogger memLogger
           
private  java.lang.Thread thread
           
 
Fields inherited from class com.bitfactoryinc.logging.Logger
application, defaultFilterClass, defaultFormatterClass, enabled, filter, formatter
 
Constructor Summary
InsistentLogger(Logger aLogger, int capacity, int anIntervalSeconds)
           
 
Method Summary
protected  boolean doLog(LogEntry aLogEntry)
          We're past filtering at this point.
private  Logger getActiveLogger()
           
private  int getIntervalSeconds()
           
private  Logger getLogger()
           
private  MemoryLogger getMemLogger()
           
private  java.lang.Thread getThread()
           
private  boolean handleLogFailure(LogEntry aLogEntry)
           
 void run()
           
private  void setIntervalSeconds(int newIntervalSeconds)
           
private  void setLogger(Logger newLogger)
           
private  void setMemLogger(MemoryLogger newMemLogger)
           
private  void setThread(java.lang.Thread newThread)
           
private  boolean shouldContinue()
           
private  void start()
           
 void stop()
           
 
Methods inherited from class com.bitfactoryinc.logging.Logger
getApplication, getDefaultFilterClass, getDefaultFormatterClass, getFilter, getFormatter, getSeverityThreshold, isEnabled, log, log, log, logCritical, logCritical, logDebug, logDebug, logError, logError, logFatal, logFatal, logInfo, logInfo, logStatus, logStatus, logWarning, logWarning, setApplication, setDefaultFilter, setDefaultFilterClass, setDefaultFormatter, setDefaultFormatterClass, setEnabled, setFilter, setFormatter, setSeverityThreshold, shouldLog, writeToLog
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

logger

private Logger logger

memLogger

private MemoryLogger memLogger

intervalSeconds

private int intervalSeconds

thread

private java.lang.Thread thread
Constructor Detail

InsistentLogger

public InsistentLogger(Logger aLogger,
                       int capacity,
                       int anIntervalSeconds)
Method Detail

doLog

protected boolean doLog(LogEntry aLogEntry)
Description copied from class: Logger
We're past filtering at this point. Now it's time to really log aLogEntry. Subclasses might want to do something more interesting and override this method.
Overrides:
doLog in class Logger

getActiveLogger

private Logger getActiveLogger()

getIntervalSeconds

private int getIntervalSeconds()

getLogger

private Logger getLogger()

getMemLogger

private MemoryLogger getMemLogger()

getThread

private java.lang.Thread getThread()

handleLogFailure

private boolean handleLogFailure(LogEntry aLogEntry)

run

public void run()
Specified by:
run in interface java.lang.Runnable

setIntervalSeconds

private void setIntervalSeconds(int newIntervalSeconds)

setLogger

private void setLogger(Logger newLogger)

setMemLogger

private void setMemLogger(MemoryLogger newMemLogger)

setThread

private void setThread(java.lang.Thread newThread)

shouldContinue

private boolean shouldContinue()

start

private void start()

stop

public void stop()

© 2002 - Lorne Brinkman
www.TheObjectGuy.com
Lorne@TheObjectGuy.com