I am attempting to find a logging framework for a Cocoa application, written in ObjC.
What I\'ve attempted so far:
You can redirect standard error output to a file. Here is the method that redirects console output into a file in application’s Documents folder. This can be useful when you want to test your app outside your development studio, unplugged from your mac.
-(void) redirectNSLogToDocuments {
NSArray *allPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [allPaths objectAtIndex:0];
NSString *pathForLog = [documentsDirectory stringByAppendingPathComponent:@"yourFile.txt"];
freopen([pathForLog cStringUsingEncoding:NSASCIIStringEncoding],"a+",stderr);
}
After executing this method all output generated by NSLog will be forwarded to specified file. To get your saved file open Organizer, browse application’s files and save Application Data somewhere in your file system, than simply browse to Documents folder.