Interface LogEventListener
-
- All Known Implementing Classes:
XALogger
public interface LogEventListenerThis interface is implemented by users of the Logger.If a LogEventListener is registered, the logger will call the LogEventListener when interesting Log Events occur. For example, the Logger will notify the LogEventListener when the current log file is 50% full to allow the application to copy old log entries forward.
If the application does not register a LogEventListener it will not have visibility to Log events.
-
-
Field Summary
Fields Modifier and Type Field Description static intDEBUGused to log low level events.static intERRORused to log non-fatal error messages.static intFATALused to log fatal error messages that should cause shutdown of the application using HOWL.static intINFOused to log information messages such as file open/close.static intTRACEused to trace method entry/exit and other low level events.static intWARNused to log warnings.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanisLoggable(int level)determine if log messages for requested level will be written to the log.voidlog(int level, java.lang.String message)write a log message to the event log.voidlog(int level, java.lang.String message, java.lang.Throwable thrown)write a log message to the event log with exception information.voidlogOverflowNotification(long logkey)Called by Logger to notify the LogEventListener that a log file overflow is approaching.
-
-
-
Field Detail
-
TRACE
static final int TRACE
used to trace method entry/exit and other low level events.- See Also:
- Constant Field Values
-
DEBUG
static final int DEBUG
used to log low level events.- See Also:
- Constant Field Values
-
INFO
static final int INFO
used to log information messages such as file open/close.- See Also:
- Constant Field Values
-
WARN
static final int WARN
used to log warnings.- See Also:
- Constant Field Values
-
ERROR
static final int ERROR
used to log non-fatal error messages.- See Also:
- Constant Field Values
-
FATAL
static final int FATAL
used to log fatal error messages that should cause shutdown of the application using HOWL.- See Also:
- Constant Field Values
-
-
Method Detail
-
logOverflowNotification
void logOverflowNotification(long logkey)
Called by Logger to notify the LogEventListener that a log file overflow is approaching.- Parameters:
logkey- lowest safe log key.LogEventListener should cause log records with keys less than logkey to be copied forward to prevent a LogOverflowException.
Hopefully, the LogEventListener will be able to regenerate the records from memory without having to read the physical log file. For example, a Transaction Manager should maintain a table of transactions that are in the COMMITTING mode, with associated log key for each transaction. The logOverflowNotification method would call Logger.put() for each transaction that has a log key less than logKey .
Before returning from logOverflowNotification the LogEventListener should call Logger.mark(newMark, force) with force set to true to assure that the new records have been committed to physical disk.
-
isLoggable
boolean isLoggable(int level)
determine if log messages for requested level will be written to the log.- Returns:
- true if the log level is being logged
- See Also:
java.util.logging.Logger#isLoggable()
-
log
void log(int level, java.lang.String message)write a log message to the event log.- Parameters:
level- log levelmessage- text to be logged
-
log
void log(int level, java.lang.String message, java.lang.Throwable thrown)write a log message to the event log with exception information.- Parameters:
level- log levelmessage- text to be loggedthrown- Throwable related to the event being logged.
-
-