Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS (iPhone, iPad, iPodTouch) view real-time console log terminal

Tags:

ios

Is there a way to view the real-time console log to view NSLog and other debug messages in a real-time manner, such as adb logcat?

like image 539
Arunabh Das Avatar asked Sep 01 '11 23:09

Arunabh Das


People also ask

How do I view console logs in iOS?

Double-click the name of the device that you are running the log file on. Click Console (from the window's main menu). The activity log displays on screen.

How do I view console log in iOS Safari?

Open the iPhone Settings menu. On an iPhone with an early version of iOS, access the Debug Console through Settings > Safari > Developer > Debug Console. When Safari on the iPhone detects CSS, HTML, and JavaScript errors, details of each display in the debugger.


8 Answers

The solution documented by Apple in Technical Q&A QA1747 Debugging Deployed iOS Apps for Xcode 6 is:

  1. Choose Window -> Devices from the Xcode menu.
  2. Choose the device in the left column.
  3. Click the up-triangle at the bottom left of the right hand panel to show the device console.

Screenshot with up-triangle

like image 174
Marián Černý Avatar answered Oct 04 '22 07:10

Marián Černý


Two options:

libimobiledevice is installable via homebrew and works great. Its idevicesyslog tool works similarly to deviceconsole (below), and it supports wirelessly viewing your device's syslog (!)

I've written more about that on Tumblr tl;dr:

brew install libimobiledevice
idevice_id --list // list available device UDIDs
idevicesyslog -u <device udid>

with the device connected via USB or available on the local wireless network.


(Keeping for the historical record, from 2013:) deviceconsole from rpetrich is a much less wacked-out solution than ideviceconsole above. My fork of it builds and runs in Xcode 5 out of the box, and the Build action will install the binary to /usr/local/bin for ease of use.

As an additional helpful bit of info, I use it in the following style which makes it easy to find the device I want in my shell history and removes unnecessary > lines that deviceconsole prints out.

deviceconsole -d -u <device UDID> | uniq -u && echo "<device name>"
like image 21
cbowns Avatar answered Oct 04 '22 07:10

cbowns


EDIT: Please use @cbowns solution - deviceconsole is compatible with iOS9 and much easier to use.

This is a open-source program that displays the iDevice's system log in Terminal (in a manner similar to tail -F). No jailbreak is required, and the output is fully grep'able so you can filter to see output from your program only. What's particularly good about this solution is you can view the log whether or not the app was launched in debug mode from XCode.

Here's how:

Grab the libimobiledevice binary for Mac OS X from my github account at https://github.com/benvium/libimobiledevice-macosx/zipball/master

Follow the install instructions here: https://github.com/benvium/libimobiledevice-macosx/blob/master/README.md

Connect your device, open up Terminal.app and type:

idevicesyslog

Up pops a real-time display of the device's system log.

With it being a console app, you can filter the log using unix commands, such as grep

For instance, see all log messages from a particular app:

idevicesyslog | grep myappname

Taken from my blog at http://pervasivecode.blogspot.co.uk/2012/06/view-log-output-of-any-app-on-iphone-or.html

like image 33
Ben Clayton Avatar answered Oct 04 '22 08:10

Ben Clayton


Just open the Application Console.app on mac osX.

You can find it under Applications > Utilities > Console.

On the left side of the application all your connected devices are listed.

like image 25
einsA Avatar answered Oct 04 '22 07:10

einsA


Try the freeware iOS Console. Just download, launch, connect your device -- et voila!

like image 22
Peter Gluck Avatar answered Oct 04 '22 08:10

Peter Gluck


This might be what you're looking for: Xcode Organizer

like image 25
BryanH Avatar answered Oct 04 '22 07:10

BryanH


device > terminal output is on iPhone configuration app

here: http://support.apple.com/kb/DL1465

like image 20
kitchen Avatar answered Oct 04 '22 08:10

kitchen


You have three options:

  • Xcode Organizer
  • Jailbroken device with syslogd + openSSH
  • Use dup2 to redirect all STDERR and STDOUT to a file and then "tail -f" that file (this last one is more a simulator thing, since you are stuck with the same problem of tailing a file on the device).

So, to get the 2º one you just need to install syslogd and OpenSSH from Cydia, restart required after to get syslogd going; now just open a ssh session to your device (via terminal or putty on windows), and type "tail -f /var/log/syslog". And there you go, wireless real time system log.

If you would like to try the 3º just search for "dup2" online, it's a system call.

like image 39
fbernardo Avatar answered Oct 04 '22 09:10

fbernardo