java.lang.Object
java.util.logging.Handler
java.util.logging.StreamHandler
java.util.logging.FileHandler
com.clumd.projects.java_custom_logging.logging.controllers.DenseFileController
All Implemented Interfaces:
CustomLogHandler

public class DenseFileController extends FileHandler implements CustomLogHandler
  • Field Details

  • Constructor Details

    • DenseFileController

      public DenseFileController(String pathToLogFile, int singleFileLogSize, int logFileRotations, boolean appendMode) throws IOException, SecurityException
      Pass-through constructor ensuring we will use the desired custom formatter, and match ALL records.
      Parameters:
      pathToLogFile - The pattern to match for the logfile's title.
      singleFileLogSize - This is the max file size before the logger will rotate files (in regular Bytes).
      logFileRotations - This is the max number of log files to keep in rotation before overwriting the first one.
      appendMode - Should always be true to ensure we are in append mode.
      Throws:
      IOException - Thrown if we cannot find the location or there is an error getting it.
      SecurityException - Thrown if we do not have the correct permissions to be writing to this location.
  • Method Details

    • acceptLogRootRefs

      public void acceptLogRootRefs(@NonNull @NonNull UUID specificRunID, @NonNull @NonNull String systemID, @NonNull @NonNull Map<Long,String> overriddenThreadNames)
      Description copied from interface: CustomLogHandler
      A method to act as an initialiser for any Custom Log Controller
      Specified by:
      acceptLogRootRefs in interface CustomLogHandler
      Parameters:
      specificRunID - A unique identifier for any given specific 'run' of the system.
      systemID - An identifier for the hostname of the hardware running this instance.
      overriddenThreadNames - A map between ThreadIDs and their human-readable names, perhaps describing what they do.
    • isLoggable

      public boolean isLoggable(LogRecord logRecord)
      Overrides:
      isLoggable in class StreamHandler
    • setFormatter

      public void setFormatter(Formatter newFormatter) throws SecurityException
      Overrides:
      setFormatter in class Handler
      Throws:
      SecurityException