How do I combine all my log levels into one file? #155

ratkins opened this Issue Nov 5, 2013 · 3 comments


None yet
3 participants

ratkins commented Nov 5, 2013

I'm configuring my logging like this:

[DDLog addLogger:[[DDFileLogger alloc] init]];

When I look in my device's AppData/Library/Caches/Logs directory, I have four separate log files—one for each of the default levels (Error, Warn, Info, Verbose). I want them all in the same file. How do I do that?


bpoplauschi commented Nov 5, 2013

@ratkins They shouldn't be separated by log levels, but rather by size. Try setting maximumNumberOfLogFiles to 1 for the DDLogFileManager class.

DDFileLogger *fileLogger = [[DDFileLogger alloc] init];
fileLogger.logFileManager.maximumNumberOfLogFiles = 1;
[DDLog addLogger:fileLogger];

ratkins commented Nov 5, 2013

@bpoplauschi That's what I thought too, here's what I've got:

DDFileLogger *fileLogger = [[DDFileLogger alloc] initWithLogFileManager:logFileManager];
fileLogger.maximumFileSize = 1024 * 32; // 32k max log file size
fileLogger.rollingFrequency = 60 * 60 * 24; // 24 hour rolling
fileLogger.logFileManager.maximumNumberOfLogFiles = 8;
[DDLog addLogger:fileLogger];

DDLogError(@"Congratulations, you can see Error logs!");
DDLogWarn(@"Congratulations, you can see Warn logs!");
DDLogInfo(@"Congratulations, you can see Info logs!");
DDLogVerbose(@"Congratulations, you can see Verbose logs!");

When I say fileLogger.logFileManager.maximumNumberOfLogFiles = 8; I get four separate log files with one of those "Congratulations..." lines each. When I say fileLogger.logFileManager.maximumNumberOfLogFiles = 1; I get only one file with the "Congratulations... Error logs!" line. The above code is in a class method called from application:didFinishLaunching:withOptions.


rivera-ernesto commented Dec 2, 2013

Fixed by #177.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment