Can you redirect log output of Xcode console to Terminal when running iPhone Simulator?

Viewed 13040

I don't like using Xcode's console output window when debugging an iPhone app in the Simulator (or on a device for that matter). I'd like to be able to use the Unix toolbox and do things like filter the logging output with grep. But to do this I need to get Xcode to send the logging output for the running iPhone app to the Terminal.

Is there any way to accomplish this?

6 Answers

Couldn't say how it'd work in the simulator, but redirecting stdout is not terribly difficult. Say you wanted to pipe it into your own view:

#include <unistd.h>

stderr->_write = RedirectOutputToView;
stdout->_write = RedirectOutputToView;

And use the prototype:

int RedirectOutputToView(void *inFD, const char *buffer, int size);
Related