Class TempLogFile


  • public final class TempLogFile
    extends Object
    This class represents a temporary log file which should be usually deleted if linked operation succeeded.
    • Method Detail

      • newTempLogFile

        public static TempLogFile newTempLogFile​(String prefix)
        Creates a new temporary log file.

        Log file will be generated in the OS temporary directory and its name will have the following pattern: prefix-[RANDOM_NUMBER_STRING].log

        Parameters:
        prefix - log file prefix to which log messages will be written.
        Returns:
        a new temporary log file.
      • getLogFile

        public File getLogFile()
        Gets the name of the log file.
        Returns:
        File representing the log file
      • deleteLogFileAfterSuccess

        public void deleteLogFileAfterSuccess()
        Closes the log file handler and delete the temp log file .
      • isEnabled

        public boolean isEnabled()
        Return true if a temp log file has been created and could be used to log messages.
        Returns:
        true if a temp log file has been created and could be used to log messages.
      • getPath

        public String getPath()
        Return the absolute path of the temp log file.
        Returns:
        the absolute path of the temp log file.