Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File append marker written twice #273

Open
kchlebus opened this issue Nov 7, 2018 · 1 comment
Open

File append marker written twice #273

kchlebus opened this issue Nov 7, 2018 · 1 comment

Comments

@kchlebus
Copy link

kchlebus commented Nov 7, 2018

Hi,
when I'm using shouldAppend: true option for FileDestination, after each restart file contains two append markers. That should be one append marker for one app restart. I've tried configuring XCGLogger in different ways and places, and always got the same results. The simplest configuration that causes that issue (in AppDelegate file):

let log: XCGLogger = {
    let log = XCGLogger(identifier: "advancedLogger", includeDefaultDestinations: false)
    let logPath: URL = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first!.appendingPathComponent("XCGLogger_Log.txt")
    let fileDestination = AutoRotatingFileDestination(owner: log, writeToFile: logPath, identifier: "advancedLogger.fileDestination", shouldAppend: true, appendMarker: "-- Relauched App --")
    fileDestination.outputLevel = .debug
    log.add(destination: fileDestination)
    return log
}()

Marker -- Relauched App -- is written always two times for each app restart.

Example file content after one app restart:

2018-11-07 11:36:04.559 [Info] > MyApp Version: 5.0.0 Build: 71 PID: 21908
2018-11-07 11:36:04.559 [Info] > XCGLogger Version: 6.1.0 - Level: Debug
2018-11-07 11:36:04.561 [Info] > XCGLogger writing log to: file:///Users/kchlebus/Library/Developer/CoreSimulator/Devices/6E1A0127-2499-404A-847F-153ADC2901F5/data/Containers/Data/Application/586907DA-4088-4F8B-B636-341270110AE5/Library/Caches/XCGLogger_Log.txt
-- Relauched App --
2018-11-07 11:36:04.563 [Info] > XCGLogger appending log to: file:///Users/kchlebus/Library/Developer/CoreSimulator/Devices/6E1A0127-2499-404A-847F-153ADC2901F5/data/Containers/Data/Application/586907DA-4088-4F8B-B636-341270110AE5/Library/Caches/XCGLogger_Log.txt
2018-11-07 11:36:04.563 [Debug] [LoginViewController.swift:25] viewDidLoad() > Some test debug LOG message
-- Relauched App --
2018-11-07 11:36:43.352 [Info] > MyApp Version: 5.0.0 Build: 71 PID: 22185
2018-11-07 11:36:43.352 [Info] > XCGLogger Version: 6.1.0 - Level: Debug
2018-11-07 11:36:43.354 [Info] > XCGLogger appending log to: file:///Users/kchlebus/Library/Developer/CoreSimulator/Devices/6E1A0127-2499-404A-847F-153ADC2901F5/data/Containers/Data/Application/F01DE0B8-A203-4FD5-B9CA-07C96F655E3F/Library/Caches/XCGLogger_Log.txt
-- Relauched App --
2018-11-07 11:36:43.355 [Info] > XCGLogger appending log to: file:///Users/kchlebus/Library/Developer/CoreSimulator/Devices/6E1A0127-2499-404A-847F-153ADC2901F5/data/Containers/Data/Application/F01DE0B8-A203-4FD5-B9CA-07C96F655E3F/Library/Caches/XCGLogger_Log.txt
2018-11-07 11:36:43.355 [Debug] [LoginViewController.swift:25] viewDidLoad() > Some test debug LOG message

Xcode 10.1
iOS 12.1
XCGLogger 6.1.0 installed via CocoaPods 1.5.3

Any solution?

@jbarros35
Copy link

I would be glad if any file was written on my device..l.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants