Class ServerLogger

java.lang.Object
com.iizix.server.ServerLogger

public class ServerLogger extends Object
The server logger implementation.
Author:
Christopher Mindus
  • Method Details

    • getCurrentLogFile

      public File 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

      public void initializeLog() throws IOException
      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

      public LogEntry[] getHistory()
      Gets all the history entries currently available.
      Returns:
      The array of history entries, oldest with lowest index, higher index ae newer entries.
    • addListener

      public LogEntry[] addListener(ILogHistoryListener listener)
      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 is null.
    • removeListener

      public boolean removeListener(ILogHistoryListener listener)
      Removes a listener.
      Parameters:
      listener - The listener to remove.
      Returns:
      true if listener is successfully removed, false otherwise.