Class SafeFileTarget

  • All Implemented Interfaces:
    ErrorAware, LogTarget, Closeable

    public class SafeFileTarget
    extends FileTarget
    A target that will open and close a file for each logevent. This is slow but a more reliable form of logging on some filesystems/OSes. It should only be used when there is a small number of log events.
    • Constructor Detail

      • SafeFileTarget

        public SafeFileTarget​(java.io.File file,
                              boolean append,
                              Formatter formatter)
                       throws java.io.IOException
        Construct file target to write to a file with a formatter.
        Parameters:
        file - the file to write to
        append - true if file is to be appended to, false otherwise
        formatter - the Formatter
        Throws:
        java.io.IOException - if an error occurs