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.

5 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?

  5. Anita says:

    Thank you sooooo much!! I had this issue in Xcode 7.2 with El Capitan. I spent one and half days trying to figure out what had suddenly gone wrong after the upgrade to El Capitan. I even re-installed Xcode but the issue was still there. I just dropped your file in and it started working!!

Leave a Reply

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