I am Using cocoaLumberjack logging framework for iOS logging. For storing logs in a file I used this code.
DDFileLogger* fileLogger = [[DDFileLogger alloc] i
If you're using CocoaLumberjack, you have DDFileLogger.h and you can expose the currentLogFileInfo: method that is implemented already:
@interface DDFileLogger : DDAbstractLogger
...
- (DDLogFileInfo *)currentLogFileInfo;
@end
Then, you can programmatically access the path to the current file with:
// configure logger
DDFileLogger *fileLogger = [DDFileLogger new];
[DDLog addLogger:fileLogger];
[DDLog addLogger:[DDTTYLogger sharedInstance]];
DDLogInfo(@"log file at: %@", [[fileLogger currentLogFileInfo] filePath]);
Which, on my iPhone, printed:
log file at: /var/mobile/Applications/3BE1219F-78BE-491C-B68C-74D6FA0C2EF1/Library/Caches/Logs/log-5D1286.txt
to both the console and the file.