What is the best practice to log errors/events in an iPhone application? I'm not talking about debugging, but after an app has been released. I mean, I'd like to collect errors/events logs when the app is running in released mode (not debug mode). (When needed I can ask the user to voluntarily send the file to my server for analysis.)

(Does NSLog have any effect if it is not running in debug? If so, where does it write to? And, how to clear any contents programatically?)