Skip to content

Rolled logs, old files deleted on process (app) restart #310

@driftwoodstudio

Description

@driftwoodstudio

Running app (iOS app) generates log files:

  • some.log (lets call this "File A")
  • some_timestamp1.log
  • some_timestamp2.log

Then app is quit (force quit by user, or invisibly by iOS).

User returns to app (re-launching it).

File state is now:

  • some.log (new, starts empty, is NOT "File A" !)
  • some_timestamp3.log (this IS "File A", renamed to get it out of the way)

These files are gone:

  • some_timestamp1.log
  • some_timestamp2.log

Describing effect in words: "when you create a new instance of XCGLogger with same configuration, it loses the previous file set (old, rolled log files) and keeps only the most recent 'active' log file by rolling (renaming) it. Data is lost that should have been kept according to the config for max number of rolled log files to keep."

Swift code for setup:

let logger = XCGLogger(identifier: config.identifier, includeDefaultDestinations: true)

file.targetMaxFileSize = 1024 * 100

file.targetMaxLogFiles = 3

file.outputLevel = .debug

file.showThreadName = false

file.showLogIdentifier = false

file.showFileName = false

logger.add(destination: file)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions