Hi,
I've used NSLog in Cocoa to do basic "printf style debugging" while running the app from Xcode to see the log statements in the Xcode console. Then I normally remove all the NSLog statements when I'm done.
I recently observed that if I leave such NSLog statements in my Cocoa app that they end up in the system-wide console.log. Actually I guess I knew that, but it still surprised me when I saw them because I wasn't expecting it.
Anyway, down the road a bit I was thinking of making a crash reporter for my little app. And I thought it would be more convenient later if I make my app write its NSLogs to its own log file rather than the system-wide console.log. Thus I'm curious how I make my NSLog statements go to their own file rather than the standard system-wide console.log. Also, is it considered to be OK, correct, acceptable, or proper for an app to write to its own log file, or would that be considered improper, bad, etc for some reason? If so, why?
In looking up NSLog the docs say it calls NSLogv, and the docs for NSLogv say it writes the messages to STDERR_FILENO. So does that mean I'd just create my own file in ~/Library/Logs and open it and set the STDERR_FILENO file descriptor to it at launch? Is there anything else I should be aware of if I'm doing this?
Any advice, suggestions, etc are greatly appreciated. Thanks!