Is there a way to read what NSLog is writing from within the app?
Posted
by Jared P
on Stack Overflow
See other posts from Stack Overflow
or by Jared P
Published on 2010-05-15T20:42:31Z
Indexed on
2010/05/15
23:50 UTC
Read the original article
Hit count: 426
I have already tried
stderr = stdout = fopen("/Users/Jared/Desktop/Untitled.txt", "w");
just as a test (obvi not production code) and this works fine for printf and some errors, but fails to redirect NSLog. I would like to be able to read what is being sent to NSLog as a string, and preferably prevent it from actually going into the system logs, although I don't particularly care if it has to. I need it to redirect logging from both my own code and apple's frameworks, which is why I can't just write a function that would append logs to a string.
Thanks
© Stack Overflow or respective owner