- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Setup logging (with our custom formatter)
LogMessageFormatter *formatter = [[LogMessageFormatter alloc] init];
[[DDTTYLogger sharedInstance] setLogFormatter:formatter];
[DDLog addLogger:[DDTTYLogger sharedInstance]];
self.fileLogger = [[DDFileLogger alloc] init];
NSString* baseDocDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
NSString* logDir = [NSString stringWithFormat:@"%@/UnitLog",baseDocDir];
DDLogFileManagerDefault* logFileManager = [[[DDLogFileManagerDefault alloc ]initWithLogsDirectory:logDir] autorelease];
self.fileLogger = [[[DDFileLogger alloc] initWithLogFileManager:logFileManager]autorelease];
//...other settings...
self.fileLogger.rollingFrequency=0;
self.fileLogger.maximumFileSize=1024 * 500; // 500KB;
self.fileLogger.logFileManager.maximumNumberOfLogFiles=10;
[self.fileLogger setLogFormatter:formatter];
[DDLog addLogger:self.fileLogger];
}
1) the issue i'm having is: some times some logging is missing and that too the starting part. For suppose, the user has take 5 surveys. On the server, i see 4 log files of data. When i open the first log file, it has only a part of the logging for the first survey. It's missing the starting of the part of the log!
my questions is since i have set maximumNumberOfLogFiles=10, and i'm deleting the log files once the user replicates the logs to the server even though the number of logs created are <10, is this causing my log data to be lost?
2) As you can see above, i've the xcode console logger and the file loggers configured in the applicationDidFinishLaunching method of my app. And then i use DDLogWarn statements in my survey module classes to log the survey logging to both the xcode console and the log file. the issue i'm having is the first time i open my app, go to surveys list and take some surveys, it is logging to both the xcode and the log file well. But when I sync to upload the survey data and the logs to the server, and then come back to take some more surveys, it just logs to the xcode console and doesnt create a new log file and so doesn't log to the file! I thought configuring the loggers in the applicationDidFinishLaunching method is just enough or do i need to do any thing else in this regards? can some one help me in this regards?
thanks in advance.