DaveWoodCom / XCGLogger

A debug log framework for use in Swift projects. Allows you to log details to the console (and optionally a file), just like you would have with NSLog() or print(), but with additional information, such as the date, function name, filename and line number.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AutoRotatingFileDestination crashes

gilroykilroy opened this issue · comments

I've been seeing a few of these crashes:

*** -[NSConcreteFileHandle synchronizeFile]: No such file or directory

0 CoreFoundation __exceptionPreprocess + 124
1 libobjc.A.dylib objc_exception_throw + 56
2 CoreFoundation -[NSException initWithCoder:] + 0
3 Foundation _NSFileHandleRaiseOperationException + 160
4 XCGLogger block_copy_helper.11 + 26280
5 XCGLogger block_copy_helper.14 + 12280
6 XCGLogger globalinit_33_37E021B542BFDF2516C3B96896CA446C_func4 + 21728
7 XCGLogger __swift_destroy_boxed_opaque_existential_1 + 1732
8 XCGLogger __swift_destroy_boxed_opaque_existential_1 + 2668
9 XCGLogger swift_rt_swift_isUniquelyReferenced_nonNull_native + 20816
10 XCGLogger swift_rt_swift_isUniquelyReferenced_nonNull_native + 8440
11 XCGLogger globalinit_33_15E519061A979936292C27E39C87C896_func37 + 11532
12 XCGLogger globalinit_33_15E519061A979936292C27E39C87C896_func34 + 16136
13 XCGLogger globalinit_33_15E519061A979936292C27E39C87C896_func34 + 11536

@gilroykilroy Can you please give me some more info. How you're reproducing this. What version of Xcode etc you're using.

Ok thanks.

Hi i use the XCGLogger Version 6.1.0 github "DaveWoodCom/XCGLogger" "6.1.0" and get sometimes the File Rotataion Crash at syncronizeFile()
may be you will add a Lock on the File Handler to fix it?

private func closeFile() { logFileHandle?.synchronizeFile() logFileHandle?.closeFile() logFileHandle = nil }

Here is the Crash Report

`Application Specific Information:
*** Terminating app due to uncaught exception 'NSFileHandleOperationException', reason: '*** -[NSConcreteFileHandle synchronizeFile]: No such file or directory'

Last Exception Backtrace:
0 CoreFoundation 0x00000001948c4ec4 __exceptionPreprocess + 228
1 libobjc.A.dylib 0x0000000193a95a40 objc_exception_throw + 52
2 CoreFoundation 0x00000001947cb594 +[NSException raise:format:] + 112
3 Foundation 0x0000000195318610 NSFileHandleRaiseOperationException + 156
4 XCGLogger 0x000000010d25a38c XCGLogger.FileDestination.rotateFile(to: Any, closure: (Swift.Bool) -> ()?) -> Swift.Bool (FileDestination.swift:137)
5 XCGLogger 0x000000010d249478 XCGLogger.AutoRotatingFileDestination.rotateFile() -> () (AutoRotatingFileDestination.swift:237)
6 XCGLogger 0x000000010d249768 XCGLogger.AutoRotatingFileDestination.write(message: Swift.String) -> () (AutoRotatingFileDestination.swift:283)
7 XCGLogger 0x000000010d23902c closure #1 () -> () in XCGLogger.BaseQueuedDestination.output(logDetails: XCGLogger.LogDetails, message: Swift.String) -> () (BaseQueuedDestination.swift:41)
8 XCGLogger 0x000000010d238bcc XCGLogger.BaseQueuedDestination.output(logDetails: XCGLogger.LogDetails, message: Swift.String) -> () (BaseQueuedDestination.swift:48)
9 XCGLogger 0x000000010d23ea8c XCGLogger.BaseDestination.process(logDetails: XCGLogger.LogDetails) -> () (BaseDestination.swift:124)
10 XCGLogger 0x000000010d2400c4 protocol witness for XCGLogger.DestinationProtocol.process(logDetails: XCGLogger.LogDetails) -> () in conformance XCGLogger.BaseDestination : XCGLogger.DestinationProtocol in XCGLogger (:0)
11 XCGLogger 0x000000010d25dff8 XCGLogger.XCGLogger.logln(
: XCGLogger.XCGLogger.Level, functionName: Swift.String, fileName: Swift.String, lineNumber: Swift.Int, userInfo: [Swift.String : Any], closure: () -> Any?) -> () (XCGLogger.swift:335)
12 XCGLogger 0x000000010d25dc7c XCGLogger.XCGLogger.logln(: XCGLogger.XCGLogger.Level, functionName: Swift.StaticString, fileName: Swift.StaticString, lineNumber: Swift.Int, userInfo: [Swift.String : Any], closure: () -> Any?) -> () (XCGLogger.swift:313)
13 XCGLogger 0x000000010d25f9d0 merged XCGLogger.XCGLogger.verbose(
: @autoclosure () -> Any?, functionName: Swift.StaticString, fileName: Swift.StaticString, lineNumber: Swift.Int, userInfo: [Swift.String : Any]) -> () + 144
14 XCGLogger 0x000000010d25f2ac XCGLogger.XCGLogger.warning(: @autoclosure () -> Any?, functionName: Swift.StaticString, fileName: Swift.StaticString, lineNumber: Swift.Int, userInfo: [Swift.String : Any]) -> () + 28
15 Ticketing-Offline 0x00000001031135b4 generic specialization <Ticketing_Offline.TSDataImageDownloadResponse> of closure #3 (Alamofire.DefaultDownloadResponse) -> () in closure #1 (RxSwift.AnyObserver) -> RxSwift.Disposable in Ticketing_Offline.TSAPIService.download(
: Swift.String, destinationPath: Swift.String, method: Alamofire.HTTPMethod, parameters: [Swift.String : Any]?, headers: [Swift.String : Swift.String]?) -> RxSwift.Observable (TSAPIService.swift:390)
`