37

I'm using instruments for allocations, but want to see my NSLog messages. In another post they mentioned to look inside /Applications/Utilities/Console for the messages. I can't seem to spot any of them. After you open the Console App, where would you look?

Black Frog
  • 11,595
  • 1
  • 35
  • 66
prostock
  • 9,327
  • 19
  • 70
  • 118

4 Answers4

54

You can view the console of the device using Xcode Organizer. Screenshot of Organizer

In Xcode 6, the "Devices" tab was removed from the Organizer into it's own window. To view the console log, you now have to click the tiny little triangle in the lower left-hand area of the device information.

Xcode 6 iOS Device Console Log Example

Black Frog
  • 11,595
  • 1
  • 35
  • 66
  • 3
    Is there no way to tail -f a log file to do this? – Arunabh Das Sep 02 '11 at 03:33
  • 1
    What if you're using the simulator? I don't see that in the Xcode Organizer, so where I can I find the NSLog output if I'm running the simulator through instruments? ... Never mind, just found it. I just fired up the "Console" app from spotlight and I now see it. I was just expecting to see it somewhere in the Xcode environment. – Rob Jun 30 '12 at 15:22
  • @Rob if you are using the simulator then you have access to the source code and would view it in the xcode console instead of organizer – Bot Dec 04 '12 at 17:01
  • 5
    @Bot - Yes, when debugging an app, you are correct, you can just see it in the Xcode console. But if using Instruments, e.g. doing some Time Profiling in Analyzer, the `NSLog` statements don't show up in Xcode. If using a device, you can see it in the Xcode device organizer like Black Frog pointed out, but if using the simulator, you find them in the Mac OS X `Console` app (just like the original question pointed out). – Rob Dec 04 '12 at 17:31
  • I can say too: if using the organizer and simulator, you won't be able to see logs from within the app with NSLog. for me, it won't even work with the phone and the Xcode orgnaizer... NSLog just don't seem to work. – otmezger Apr 23 '13 at 13:10
  • anyone find a solution for the simulator? i.e. how to see NSLog or print statements when using Instruments with a simulator? – Greg Jun 02 '16 at 21:35
5

Alternative to Black Frogs answer, you can also use the integrated console from your mac directly without Xcode. All output is forwarded there. Just do a spotlight search (CMD + Space) and type in console.

denbec
  • 1,321
  • 18
  • 25
4

If you want to use the Console Application, the Xcode log can be found under the FILES section in the Log List (If not visible:Menu -> View -> Show Log List). Look for

~/Library/Logs/iOS Simulator/6.1/system.log

This is actually just a reference to the file system. So you could to a

tail -f ~/Library/Logs/iOS Simulator/6.1/system.log

in the Terminal as well.

Update:

Another option in some newer versions of Xcode can be found in the Xcode 'Debug' menu. Look for the entry 'Open System Log...'.

Klaas
  • 22,394
  • 11
  • 96
  • 107
4

As of Xcode 6.3.1, I couldn't find the log in any of the above locations when running the Allocations instrument. For me, in iOS Simulator (not Xcode), click Debug -> Open System Log... to get the NSLog messages normally appearing in Xcode. In case you need it, this log is kept in Library/Logs/CoreSimulator/[device name]/system.log. To get [device name], go to Xcode, Window -> Devices and find the device that you are currently simulating. Look for the Identifier. Compare that against the folder names in Library/Logs/CoreSimulator and you should find a match.

dolios
  • 1,936
  • 1
  • 10
  • 10