I am using CocoaLumberjack/Swift
Pod in my iOS project.
The problem is, I am getting always Current day(Today or Last day of last time app launched) log files. CocoaLumberjack doesn't keeping old log files of Previous days.
For me Today is 2020-02-19. And the files I get from CocoaLumberjack:
xyz 2020-02-19--05-55-39-774.log // file size -> 10 MB
xyz 2020-02-19--05-55-46-305.log // file size -> 1.7 MB
** There are no older files from previous days
I disabled Time Based Rolling.
logger.rollingFrequency = -1 // also tried with 0
And Use 10 MB memory limit for each file
logger.maximumFileSize = 10 * (1024 * 1024) //10MB
According the CocoaLumberjack document.
* You may optionally disable rolling due to filesize by setting `maximumFileSize` to zero.
* If you do so, rolling is based solely on `rollingFrequency`.
Here is my source code from AppDelegate.
import CocoaLumberjack
......
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Enable CocoaLumberjack logging
self.setLoggingProperty()
}
private func setLoggingProperty() {
if #available(iOS 10.0, *) {
DDLog.add(DDOSLogger.sharedInstance)
} else {
// Fallback on earlier versions
DDLog.add(DDASLLogger.sharedInstance)
if let dDTTYLogger = DDTTYLogger.sharedInstance {
DDLog.add(dDTTYLogger)
}
}
let logger: DDFileLogger = DDFileLogger.init()
logger.maximumFileSize = 10 * (1024*1024) //10MB
logger.rollingFrequency = -1 // Disable time base rolling
logger.logFileManager.maximumNumberOfLogFiles = 7
DDLog.add(logger)
}
Does anyone faces similar issue? Am I missing something?