Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Senor Cuete

macrumors 6502
Original poster
Nov 9, 2011
432
32
I am logging some messages for debugging using NSLog(). When I run my project the debugger panes don't appear until execution is stopped at a breakpoint. Then the variable inspector and console appear. I want to look at messages in the console whether I've hit a breakpoint of not. I can't figure out how to make XCode keep the debugger panes open. The only way for me to see all console messages is to set a meaningless breakpoint near the start of the program, allow it to stop (opening the debugger panes) and then continue.

I opened the Console app to see if logged messages would be there but calling NSLog() doesn't appear to write to it. It would be useful for me to log some error messages to the Console to help me support my users. How can I configure my app so that NSLog() writes to the Console?

I also tried printf(). It opens the debugger panes and shows what I printed even if a breakpoint hasn't been encountered but doesn't print to the Console app.

This was much easier in XCode 3, which had a separate console window that automatically opened when you ran your project.
 
Last edited:
Have you tried clicking on the three items under "View"?

Sarcasm ignored. Yes, I can open the debug panes with the View->Debug Area->Show Debug Area Menu item but when I stop my app with the Stop button the debug panes disappear and I have to reopen them manually each time I run my app if I want to see logged items.
 
There are plenty of customization options in Xcode>Preferences…>Behaviours. I think “Run generates output” is what you want.
 
There are plenty of customization options in Xcode>Preferences…>Behaviours. I think “Run generates output” is what you want.

By fooling with one of the options I got it to launch with the debugger panes visible, Thanks. Now I need to figure out how to make it write to the console.
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.