8

I have place several NSLog() in my iOS application, is it possible to see all the logs later on my Mac that was generated when the app ran on iPhone handset even when iPhone was not connected with Mac. Thanks

Firdous
  • 4,624
  • 13
  • 41
  • 80

7 Answers7

2

You can view crash logs from your iPhone in the Organizer.

If you want to view your own log statements, you could consider TestFlight ( http://testflightapp.com ). They offer an SDK which includes features for remote logging.

Rens Verhage
  • 5,688
  • 4
  • 33
  • 51
2

Unfortunately this is not possible. The only thing that you can get is a Crash Log. If you need a better logging system, I suggest to take a look to CocoaLumberjack, a very powerful logging framework that gives you the opportunity to save log in files and, eventually, send them to a server. You also have many different levels like: log info, log error, log warning, etc...

bontoJR
  • 6,995
  • 1
  • 26
  • 40
2

No. You can however redirect NSLog to a file, using something like this: http://blog.coriolis.ch/2009/01/09/redirect-nslog-to-a-file-on-the-iphone/

Then you can access the file via Xcode, or upload it with your app. File usage and privacy issues apply.

Keep in mind that NSLog is supposed to be turned off in published apps, so you may want to use a different logging app. A number of NSLog alternatives are available.

Yusuf X
  • 14,513
  • 5
  • 35
  • 47
  • link is dead and Google cache doesn't seem to have it – ine Mar 31 '13 at 21:49
  • 1
    Darn internet! Well here's another one that says the same thing: http://objcolumnist.com/2009/12/19/redirecting-nslog-to-a-log-file/ – Yusuf X Apr 01 '13 at 16:02
1

I'm fairly certain that's not possible. The device needs to be connected to the Mac in order to run in Xcode's debug mode, and you need to be in debug mode to view the console, which contains your NSLogs.

Jezen Thomas
  • 13,619
  • 6
  • 53
  • 91
0

There is a crash log for every crash that occurs on the phone, which is readable after connecting to your mac. These NSLog's don't appear in this log nor do they appear anywhere else in a (semi) permanent manner.

Manuel
  • 10,153
  • 5
  • 41
  • 60
0

It's possible using custom macros and a custom class which will write each message in the documents directory in a file. If the file sharing is enabled in the app you can later download them in iTunes.

Templar
  • 1,694
  • 1
  • 14
  • 32
0

Seeing the logs in mac might not be possible. But you can send the log to testflight using TFLog(). But you will need to distribute your app through testflightapp. And integrate the sdk. I think that is what you are looking for. try out - testflightapp.com

Mahbub Morshed
  • 915
  • 9
  • 20