Package com.iizix.server
Class ServerLogger
java.lang.Object
com.iizix.server.ServerLogger
The server logger implementation.
- Author:
- Christopher Mindus
Method Summary
Modifier and TypeMethodDescriptionLogEntry[]
addListener
(ILogHistoryListener listener) Adds a new listener.Gets the current log file.LogEntry[]
Gets all the history entries currently available.int
Gets the maximum history size.void
Initializes the logging to file, or rotates the log file.boolean
removeListener
(ILogHistoryListener listener) Removes a listener.
Method Details
getCurrentLogFile
Gets the current log file.- Returns:
- The file for the current server log, null if not used or not yet started.
getMaximumHistorySize
public int getMaximumHistorySize()Gets the maximum history size.- Returns:
- Value range is 100 to 5000.
initializeLog
Initializes the logging to file, or rotates the log file.In case of an I/O error, the logger attempts to restore the previous log file, or worst case starts writing to the console.
- Throws:
IOException
- For I/O errors.
getHistory
Gets all the history entries currently available.- Returns:
- The array of history entries, oldest with lowest index, higher index ae newer entries.
addListener
Adds a new listener. Calling this method multiple times with the same listener will have no effect (but to return false).- Parameters:
listener
- The listener to add.- Returns:
- The array of history entries.
- Throws:
NullPointerException
- If the listener isnull
.
removeListener
Removes a listener.- Parameters:
listener
- The listener to remove.- Returns:
- true if listener is successfully removed, false otherwise.