Write stderr on iPhone to both file and console
I'm following the suggestion in the answer here for redirecting NSLog output on an iOS device to a file, which works great. The problem is that it no longer shows up in the console on the device. What I'd really like is a way to tee the stderr stream to both the console and the file. Does anyone have an idea how to do that? David Potter I found an acceptable answer on another thread ( NSLog() to both console and file ). The solution provided there is to only redirect to a file if a debugger is not detected, like this: if (!isatty(STDERR_FILENO)) { // Redirection code } Thanks to Sailesh for