Objective C code to access device console log in iOS - iphone

Is there any way to access the device console log as shown in Xcode -> organiser -> device -> console using objective C.
I have tried using asl.h but it just gives me the nslog messages.What i want is the other messages to read in objective c program which are logged in device console.

In github see this projcet,its help you
https://github.com/sumitmundra/AksDeviceConsole

Related

Are logs made with NSLog or CCLog stored in the iPhone? Can I retrieve them?

When testing my iOS application on a device connected to Xcode, logs from NSLog or CCLog appear in the console, which is very useful for me to debug.
When the device is not connected to Xcode, obviously I don't get such logs. And when it crashes, I simply don't know why.
Because of this, I made a question here: Is there an output log like Xcode's available locally in my iPhone?. But I have noticed that those "Device Logs" are not the logs I expected. In fact, they are greatly different from the logs I see in my Xcode console, and none of them reflects a NSLog or CCLog I have done in my project. So I guess I was looking in the wrong place.
Are NSLogs or CCLogs stored somewhere I can retrieve? I don't really understand the "Device Logs", but they really don't seem to tell me anything useful or specific.
Connect your device to your computer and in XCode, windows Organizer, you can see the devices. You can select your device and then click on Console. It should show you all the NSLog statements
Your crashes are logged in your device so you can retrieve them when you connect your phone to the XCode.
1 - Plug it in
2 - Open you XCode and go to Organizer (cmd + shift + 2)
3 - Click on Devices and then on the upper left click on Device Logs.
To add something to the other (pretty standard) answers, here's a solution for which you don't need Xcode: the idevicesyslog utility from the libimobiledevice library can also display all logs.
Bonus: if you have a jailbroken phone, you can install syslogd from Cydia and all your syslog will be saved to a file named /var/log/syslog.
Best option is to run your app from Xcode connected to a real device and look at console output (Shift-Command-Y to display/hide console view by default).
Second best option is to connect device afterwards to your mac and use iPhone Configuration Utility to view your app specific console log.
Third best option is to use some 3rd party iPhone app, which can read console log in the device (when you're on field trip or something). Warning: I made the "Console On Device" app just for this purpose, needed to debug crashes while travelling. It can display app specific logs and allows emailing them.
In my experience, most users never look at logs, so they are useless and just waste time, space, and battery. Some people look at the logs and get worried for no good reason at all, give you bad reviews ("I looked at the logs and there are lots of bugs in the code"), all with no benefit to anyone.
So get rid of the NSLogs. Best to define a macro that does NSLog in a debug build and nothing in a release build. There shouldn't be any NSLog in your source code except for that macro.

iOS app crashes on customer device, how to react, collect data

The application crashed at the customer device. Unfortunately the app does not provide
an error log in order to identify the root cause.
I was wondering what information can be collected from the customer device in order to start
working on the issue. For example is there a core file available? What other data might help us understand the problem?
Two cases:
the customer can give the device to the developer
the customer cannot give the device to the developer
Malke the Customer get the crash log(using iTunes), search a tutorial on google about how to do it. When you have import in Xcode organizer and match it with the archive that you distribute. You shoul see a comprehensible crash log.
Tecnote Apple
We're using test flight. Test flight installs its own exception handler which provides some decent data when debugging crashes (backtrace, device type, ios version, etc.).
You can see the logs on the device:
Settings -> General -> About -> Diagnostics & Usage -> Diagnostics & Usage Data
While giving the customer the IPA and provision file also give him the .dSYM file and also send him step by step procedure to send back the crash logs through iTunes. That will help you find where exactly your app is crashing.

iPhone crash logs

I have an app in ad-hoc mode and it crash right after starts. I have access to Xcode and i try to find crash log like here: iPhone crash log?
But i have no crash log from this app. Why?
Right after app starts i can see Default.png and few second later it crash, i've never even see the mainViewController. How do get a crashlog? How to detect this error? I don't have an access to source code. I have only ad-hoc distribution.
Problem not occurs on every devices. AFAIK this is only 3GS problem. Strange.
Instead of looking for the crash log, try connecting your phone to xcode but look at the Console screen instead, run the app and you should see output on the console, see if you get an error message there.
For users who don't have access to Xcode or are running on a PC you can download Apple's iPhone Configuration Utility which also gives you access to the device console.

iPhone console for nslog?

How can i see nslog messages when I am testing on device? My only way right now is to have a UITextView and put message in there, there must be a better way..Thanks.
I went to seetings and turned on console but still don't know how to see them. Thanks.
These calls will output to your devices system log. You'll be able to get these from the XCode Organizer when you plug your phone back in.
There are also a few apps you can install from App Store on your device (search for free ones, with Console in their title, and ability to send emails with logs).
This is useful especially if you want to debug some errors on your beta testers devices, or don't want to connect your device every time you want to see what's in the console log.

Can I get console logs from my iPhone app testers?

I am testing my iPhone app with some people who install it through iTunes together with the mobile provision file that I give them. Apple has good instructions for how to get crash logs from these people, but is it also possible to get console logs from their devices? I do not have physical access to these people, otherwise I could connect their device to my computer and see the console log in Organizer. I would like to give them instructions to get me their console logs, but there doesn't seem to be a way?
Apple's iPhone Configuration Utility (available at http://www.apple.com/support/iphone/enterprise/ ) for both Mac and PC allows your users to capture log information and send it to you.
Use the iOS Console Kit from here