How to read apple system log (asl) in simulator in Objective-c? - ios

I'm using something similar to this code to read the console on a physical device, which works great. (Using iOS 7.1.2 on an iPhone 5.)
However, when I run it on the iOS Simulator (7.1.2 and Xcode 5.1.1), I get no responses from asl_search.
I've found this question which looks like it would be a duplicate, but it doesn't specify programmatic reading of the logs. So there are various solutions that require knowledge of where the actual log files live on disk.
Is there a reliable way to get asl logs on the simulator from within my app's objective-c code?
I'd like to be able to say "if device, read from asl, else if simulator, get some other way".
Is there some library that abstracts the differences in where the logs are stored? Ideally I'd like to get the log data back in the same format, so I can handle it the same way whether I'm running on a device or the simulator.
Also, I know I can't get the full syslog past iOS 6, on a real device. That's OK--I just want a way to get whatever info is available, even if it's just logs from my own app.

Related

Redirect console prints from Xcode

While developping an app for an iPad on my Mac, I use print logs to monitor what is going on (regular prints in Swift code). However I really don't like the Xcode console, and I'd like to be able to redirect the stream to a file, where I can then read it with a better log viewer (and add color!).
I'm executing the app in debug mode through Wifi on my iPad, but I want the logs on my Mac, so storing the logs to a file on the device is not really interesting (SO question here). Wrapping the debugger executable seems interesting, as suggested here but I couldn't find anything more recent (with lldb).
Alternatively, I could also run the debugger from the console and handler the redirection from there, but I don't know how to do that for debugging on a remote device over WiFi.
Any help would be greatly appreciated!

How do you access the all of the NSLog statements?

I have an application which is producing an error very intermittently, I am trying to run it down with an NSLog statement in swift. However, after I have noticed the bug has occured, when I hook up my iPhone to review the logs in the Devices window. I only see about 5 minutes worth of statements from various applications. Is there a way to get the history past what automatically comes up? Is there a way to get your applications NSLog statements only?
I haven't tried it from Swift, but we sometimes use NSLogger from Obj-C. It will log to a local Mac application instead of the console on the device. Alternatively, we sometimes log to a file and then transfer the file via email.
You can take a look at Bugfender, it's a product we have built to solve this problem. We had the same problem, especially when delivering beta apps to our customers, so we decided to make a product to solve this problem.
With Bugfender you will be able to get the device logs without any need to connect the device to your computer.
It's easy to integrate and you can choose which devices you want to get the logs from. Our service works offline and online, we have spent a lot of time to make it reliable and easy to use.

Access to iOS device's console output

Is there an iOS app which allows to look at console output created by another iOS app?
My app has several NSLog() calls which output precise timings. I would like to test the app, when it is not connected to my development Mac, and look at timings after that, possibly still on my iDevice using some other "console browser" app.
Is that possible?
So the way to do this is to use the Apple System Logger which allows you to access the logs and you can then display them on screen. NSLog will be logged to this. I wrote something a few years ago so that testers could test the app and open the log and view it on the device.
Its a bit tricky to use the interface and there is a limit, I think it was 200, on the number of logs in the cache, so log only the necessary stuff.
After a quick search, I found this - SOLogger which should help you.

How can I get live console output when device is connected to another hardware device?

So I'm trying to make an application using the DJI SDK. In order for my app to function properly, my iDevice needs to be hooked up to the remote controller of the drone via USB.
This means I can't also run the app via xcode and get console output.
Is there a way of saving console output when using an app on your phone? I am aware of the crash logs, but sadly they don't provide enough info to be useful to me.
This problem started when I got a runtime error only when the device was connected to the remote controller. Therefore there was no way of isolating the problem since I couldn't tell what went wrong.
Another solution would maybe be a 1 female to 2 male usb chord, but I haven't found one online yet and even if I did I don't know if that would work.
Is there a standard way of debugging when using hardware that needs to be connected to the device?
from Xcode, hit window on the tool bar at the top, then Devices. Select the device you want to read the log from. However, this is the log for the entire phone, and you have to be plugged into the mac... so you'll have to run your tests, unplug from the DJI, plug into the mac, go to devices, and scroll through the log until you find the output from your app, and you won't be able to see real time expected outcome.
It's not ideal, but that's the only way I know of to see the apart from building an entire console log into your app yourself.

Debugging Corona SDK application on device

I am working with Corona SDK for some time, and i really like it, but there is one thing, that i cant figure out: How to debug my code on a real device?
At the point, when my code runs great in the simulator, i usually compile it, and try it on the phone. But when there is some error, that doesn't bother the simulator, but pisses the phone off, i simply see an error message:
"This application encountered a Lua error (see logs) etc."
Me and my boss spent a whole day figuring out, that i made a require with a capital instead of lower case.
My question is: How to actually "see" that log? I tried to connect my device to DDMS, but i saw no relevant output. Is there a way to access that log (I'm testing on an android device)? Or is there a way to simulate the EXACT behavior of the phone in the simulator? Usually the phone freaks out because of i/o operations, and when using the wrong case.
The best way to debug on iOS devices is to use XCode's Organizer with your device plugged in via the USB port. On the left hand panel of Organizer, there will be a block for each device that XCode knows about. You may have to click on a button "Use device for debugging" or something similar so XCode can gather all the information it needs.
Once done, then you can use XCode to install the app to the device (you don't need to make an .ipa file, just copy the app to the device via Organizer). In that panel on the left, there is a link for "Console Log", click that and you can your print statements and other errors issued by Corona SDK.
Rob
If you don't have Xcode, you can try iPhone configuration utility. It is more light-weight than the xcode plus you can also use it on a windows machine.

Resources