java.lang.Object
net.i2p.util.LogWriter
net.i2p.util.FileLogWriter
All Implemented Interfaces:
Runnable

class FileLogWriterextends LogWriter
File-based log writer thread that pulls log records from the LogManager, writes them to the current logfile, and rotates the logs as necessary.
  • Constructor Details

    • FileLogWriter

      public FileLogWriter(LogManager manager)
      Creates a writer that drains log records to rotating files on disk.
      Parameters:
      manager - the LogManager this writer drains records from; its configuration supplies the log directory and rotation settings
  • Method Details

    • currentFile

      public String currentFile()
      File may not exist or have old logs in it if not opened yet.
      Specified by:
      currentFile in class LogWriter
      Returns:
      non-null
    • isGroupTraversable

      static boolean isGroupTraversable(File dir)
      Whether the group can traverse (search) an existing directory. Group execute on the directory is what allows a group-readable file inside it to be opened, so this is the check that decides whether group-readable log files are actually reachable.
      Parameters:
      dir - the directory to test
      Returns:
      true if the group has execute/search permission, or if permissions cannot be determined
    • writeRecord

      protected void writeRecord(LogRecord rec, String formatted)
      Write the record and its formatted text, using the record's priority.
      Specified by:
      writeRecord in class LogWriter
      Parameters:
      rec - the LogRecord to write.
      formatted - a String pre-formatted from rec, may be ignored.
    • writeRecord

      protected void writeRecord(int priority, String val)
      Write the formatted record text at the given priority.
      Specified by:
      writeRecord in class LogWriter
      Parameters:
      priority - the level to log the line at.
      val - the String to write.
    • flushWriter

      protected void flushWriter()
      Flush the log file writer.
      Specified by:
      flushWriter in class LogWriter
    • closeWriter

      protected void closeWriter()
      Close the log file writer.
      Specified by:
      closeWriter in class LogWriter