Hacking your Log Messages

More nasty code inspired by IRC conversations, but this time aimed at the iPhone SDK – although it will work on Mac OS X as well, and on WebObjects 4 for Windows NT, and probably on at least some flavours of NextStep. Simply drop this file into your project, and all NSLog() output will be redirected to stdout, using a private but documented Foundation function.

Why would you want to do that? Ahh, well, that part is covered by the iPhone SDK NDA. Lawyers, eh? It must be a pretty good reason, though, given testimonials like this.

This entry was posted in Cocoa, Code and tagged , , . Bookmark the permalink.

4 Responses to Hacking your Log Messages

  1. Awesomely useful! Thanks for posting this.

  2. Jens Ayton says:

    This also works in The Cocotron as of r646.

  3. ailicec says:

    Hello, I have to trouble you for this problem.

    I’m new to Xcode4 and Cocoa, but when I use NSLog to try to print some string, I cannot get any output… I’ve looked in the Console and debug area.

    Then I found your article via google, I added your file into my project and it way built rightly and run properly— except that I still get nothing from the debug area which I wrote in the NSLog…

    Would you help me to find out how to get NSLog output in Xcode 4 ?

  4. Jens Ayton says:

    Nothing springs to mind. Have you tried Stack Overflow?

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>