48

I am just exploring debugging as per the subject line. I am noting that while this works easily enough, the NSLog's are not outputting, but breaks do get hit. This is not helping ;) .. I don't see any obvious options in the edit scheme window.

This is to test pushes, but firstly i am just manually firing up the app to ensure the process works (with waiting for the app to manually start etc)..

Thanks for any tips..

drew..
  • 3,234
  • 3
  • 16
  • 19

2 Answers2

56

If you let the process start normally, then the logs will be hooked up to ASL already. The debugger doesn't have a good way to reroute this connection after the fact. You will have to look in the Device Console for the logs. In Xcode 6, select Windows->Devices, then there's a little disclosure widget at the bottom of the content window that will reveal the Device console.

Jim Ingham
  • 25,260
  • 2
  • 55
  • 63
  • awesome Jim, i just learned something new and very valuable, much obliged. The wonders of Xcode never cease. – drew.. Sep 27 '14 at 20:32
  • 3
    Plus one for mentioning that illusive disclousure button – AmitP May 27 '15 at 10:57
  • 2
    It's in the same place in the Devices window. It's easy to miss the little disclosure widget (it will show up in the lower left hand corner of the content pane once you've selected your device from the Device list.) But it is still there. – Jim Ingham Feb 04 '16 at 18:51
  • this console doesnt seem to include NSLog out.. only system stuff ? – bobmoff Feb 15 '16 at 12:05
  • @bobmoff it does, but it only logs things happening after you open the device logs – ratsimihah Mar 18 '16 at 16:11
  • although the log window doesn't seem expandable, is it? it's so small T_T – ratsimihah Mar 18 '16 at 16:14
  • 7
    If you are using Swift, print() will not show up in the logs, you will need to use NSLog. I also have found that the best way to see your messages is do a search for your app name in the console. Then, change any to Process, and you will only see your NSLogs (or ones that show up in the xcode console window). – Chris Slade Jul 13 '18 at 04:00
44

Use breakpoints to log whatever You want

Right click on breakpoint -> Edit Breakpoint

enter image description here

  • Check "Automatically continue after evaluating options" to make sure app won't stop at break
  • Add Action(s) to log info You need

enter image description here

Paulius Vindzigelskis
  • 2,121
  • 6
  • 29
  • 41
  • I see the original tone of this msg was altered, thank you, but this comment misses the point of the original question, which was answered a year ago. But thank you regardless.. – drew.. Oct 27 '15 at 19:42
  • 1
    Good thing about printing with breakpoints is that You don't need to recompile project. You can add/remove breakpoints on a run – Paulius Vindzigelskis Feb 10 '17 at 17:01
  • 8
    @PauliusVindzigelskis The bad thing about printing with breakpoints is that it is much slower so any debugging of time sensitive things does not go well. – chadbag Nov 20 '17 at 13:25