Type alias FileAppenderOptions

FileAppenderOptions: {
    acceptExistingFile?: boolean;
    backupCompression?: BackupCompressionMode;
    dateRollover?: boolean;
    deferredStart?: boolean;
    fileExtension?: string;
    fileNamePattern?: string;
    maxFileSize?: number;
    pretty?: boolean;
    syntax?: FileAppenderSyntax;
    targetPath?: string;
}

A simple object containing options for the FileAppender.

Type declaration

  • Optional acceptExistingFile?: boolean

    If the file name is set to a non-time pattern containing string, or a secondly started instance matches the same file name, this may be set to false in order to preserve all log files. If set to true and the log file already exists, the appender will append contents. If this is not possible, an instance counter appendix is forced.

  • Optional backupCompression?: BackupCompressionMode

    Specifies whether a log file that experienced an automatic rollover due to the FileAppenderOptions#maxFileSize option will be compressed or not.

  • Optional dateRollover?: boolean

    If the file name pattern contains a timestamp that represents the point in time when the process has started, the time stamp may need to be updated in case a new day starts. Currently, this feature is not supported.

  • Optional deferredStart?: boolean

    If set to true, the start of the appender will be deferred until it is activated.

  • Optional fileExtension?: string

    The extension to append to the fileNamePattern. Should start with a period '.'.

  • Optional fileNamePattern?: string

    The file name pattern to use, e.g. 'yyyy-MM-dd_HH-mm-ss-fff' or 'yyyy-MM-dd_HH-mm_%INSTANCE%'. The file name pattern supports placeholdes of a time formatted string, see FormattedAppender, despite most possible entries like timezone, age, etc. do not make sense when naming a log file. Additionally, an instance counter placeholder may be specified '%INSTANCE%' that is used, when FileAppenderOptions#acceptExistingFile is set to false. If a file with the same file name already exists in the target directory, this placeholder will be increased numerically, until the file is writable. If no instance-placeholder is specified and the setting FileAppenderOptions#acceptExistingFile is set to false, an instance counter will be appended anyways, if the filename exists already. The timestamp to use for the log file name will be generated once on program start. In the future, for long-running applications, the time stamp may be re-generated when the date changes using the FileAppenderOptions#dateRollover property. Path separators are supported, thus, it is possible to write all logs on a specific date to one folder. However, the instance id placeholder must not belong to the path. The full determined file name may, thus, consist of the following parts: FileNamePattern_Instance_RolloverDate.

    Note: If a static filename is to be used or static sections, these should be enclosed in quotes as the characters are treated as time string properties instead.

  • Optional maxFileSize?: number

    Specify an automatic file rollover. When this limit is exceeded, the current log is copied and optionally compressed to a new file using the moment in time when the file limit has exceeded as appendix. This option is only effective, if the log target is a file. It is ignored, if the log target is a pipe, socket, etc.

  • Optional pretty?: boolean

    If set to false, each log message consumes one line of the log file. If set to true, multiple lines may be used in order to have readable json-output, for example.

  • Optional syntax?: FileAppenderSyntax

    Specifies the syntax that is used for printing log messages to the file. Note, the syntax only applies to each log message, not to the whole file, i.e. there will be no surrounding xml element or json array.

  • Optional targetPath?: string

    The path to generate the logs to. Defaults to the current working directory. If it starts with '.', '..', or a directory name it is treated as relative path to the working directory, else it is assumed to be an absolute path. See also https://nodejs.org/docs/latest/api/path.html#pathisabsolutepath