iOS (Iphone, iPad, Ipodtouch) View Real-Time Console Log Terminal

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

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

How to read the contents of the device console on iPhone?

The console is not saved to a file on the iPhone (which is why reboots completely clear it).

I would recommend replacing your NSLogs with something that logs to the console as well as a file within the Documents directory of your app and allow provide functionality within the app to send in the file to an email.

The location of where the crash logs are kept is outside the sandbox of the application, so you can't access the crash logs directly, but sync'ing with iTunes will cause them to be uploaded to the developer's iTunes Connect account.

See logs before & after app restart

You can't see logs of an app that is not running. I can tell you this if you're really curious : there is nothing to log anyway. :)

Now you might want one of those things :

System logs :
Just go in the Device Manager of XCode (short cut is Shift-Apple-2 I think). It's in the Window Tab, under Devices. Select the device you're running on, then you'll have the logs available there.

This logs everything the device logs, so there will be a LOT of text.

App logs :

Those are the ones you already have, but you seem to clearly want the "restart" logs of your app. There is no such thing as a restart log. What you have is the logs at the start of your app, and the ones at the end. For example, what you logged in your AppDelegate's didBecomeActive or willTerminate (or even didEnterBackground).

You will only see the logs of the didBecomeActive when you actually run the app from XCode (otherwise the debugger is offline). He will start the app as if you tapped on the app icon, so no worries there.

If you decide to kill the app by swiping up, it will log the app delegate, and you'll just be able to browse it in the debugger. You can put a breakpoint if you want to make sure it enters the AppDelegate methods.

But if you want to restart the app again, you'll have to re-run it from Xcode, not manually start it on the phone.

File logging :

Another very easy solution is to log everything on a text file in the Documents directory of your app, you'll then be able to start/quit as much as you want, and let it log on the file. You can later read that file like any other file :)

How is it possible to debug ios application and watching logs similar to adb in android?

There are no framework coming from Apple, but lot's of solutions from free to really expensive.
You can try Google Analytics, Crittercism (probably the most advanced one in terms of crash/performance), Follow Analytics. I tried 3 of them and to me Google is a really nice solution (and it's free :-)). You can also implement one yourself. It's not that complex : I just finished one for a client and it took me 3 days (Unit Testing included).

How can I get the console logs from the iOS Simulator?

iOS Simulator > Menu Bar > Debug > Open System Log


Old ways:

iOS Simulator prints its logs directly to stdout, so you can see the logs mixed up with system logs.

Open the Terminal and type: tail -f /var/log/system.log

Then run the simulator.

EDIT:

This stopped working on Mavericks/Xcode 5. Now you can access the simulator logs in its own folder: ~/Library/Logs/iOS Simulator//system.log

You can either use the Console.app to see this, or just do a tail (iOS 7.0.3 64 bits for example):

tail -f ~/Library/Logs/iOS\ Simulator/7.0.3-64/system.log

EDIT 2:

They are now located in ~/Library/Logs/CoreSimulator//system.log

tail -f ~/Library/Logs/CoreSimulator//system.log



Related Topics



Leave a reply



Submit