Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what happens to NSLog info when running on a device?

Tags:

ios

iphone

nslog

what happens to NSLog info when running on a device? Where does the text go? Does it get saved? Is it therefore a big overhead when running on a device, or does it effectively get sent to null?

like image 577
Greg Avatar asked Mar 15 '11 21:03

Greg


People also ask

Where does NSLog write to?

NSLog outputs messages to the Apple System Log facility or to the Console app (usually prefixed with the time and the process id).


4 Answers

Since Xcode 6 the device manager pane has been split into its own window. (Window > Devices, or Command-Shift-2.)

Once there, select your device, then show its log by clicking the disclosure triangle at the bottom of the window to the right of the sidebar.

enter image description here

like image 129
owenfi Avatar answered Oct 19 '22 21:10

owenfi


Your device will continue logging even when it's not connected to your mac. To see the logs, you need to open Xcode, click the 'Window' menu item, and then 'Organizer'. Then select your device and then select the 'Device Logs' tab. For some reason (for me at least) viewing the logs seems flaky, so if nothing shows up, you may need to completely quit Xcode and restart it.

like image 27
FreeAsInBeer Avatar answered Oct 19 '22 19:10

FreeAsInBeer


The text is logged. You can view the logs in xcode via the (almost-invisible) disclosure triangle in the Devices window as described in another answer.

You can also access the logs in a more usable view (including filtering) by opening Console.app on your connected Mac and selecting the device on the left.

Console.app screenshot

There will be some overhead with logging, but considering the volume of logging that's going on all the time in recent versions of iOS, unless you're generating an awful lot of output (or spending time generating the messages), it's unlikely to be significant.

like image 6
CupawnTae Avatar answered Oct 19 '22 20:10

CupawnTae


It gets written to the Console log on the device. You can read it in the "Organizer" within Xcode when your device is connected.

like image 5
picciano Avatar answered Oct 19 '22 21:10

picciano