changing the digital world one bit at a time...

Blants (noun) the rants of a blogger

Writing to OS X ~/Library/Logs from your app

June 18, 2011 by The Man

In your main.m file just amend to look like the following.


int main(int argc, char *argv[]) {
    id pool = [NSAutoreleasePool new];
	NSString *logPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Logs/Depicus"];
	freopen([logPath fileSystemRepresentation], "a", stderr);
	[pool release];
    return NSApplicationMain(argc,  (const char **) argv);