Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ratkins opened this issue Nov 5, 2013 · 3 comments
Closed

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

ratkins opened this issue Nov 5, 2013 · 3 comments
Labels
Milestone

Comments

@ratkins
Copy link

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
Copy link
Member

@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
Copy link
Author

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
Copy link
Member

Fixed by #177.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants