How to get the iOS device console logs with appium java?

how to get the iOS device console logs with appium java ?

You can print them to your Appium log with the capability, showIOSLog.

thank you, and how to retrieve and store the logs into a string with java ?

I don’t think you can retrieve the logs as a whole. If you want to get the device logs into their own file I think your best bet would be to print them to the Appium log, and then do some post test run parsing on that log file to create a new log with only device logs. Some kind of regular expression would be able to help here.

Cool! I never knew there was an option for this! I’ve been calling out to the terminal and running: idevicesyslog

and how to get the appium logs in java ?

can you capture and use the logs in your automation code?

Print them to a file, or log. Then you can parse them post tests or whatever.

i open the appium log file in: /tmp/appium.log, but the device console logs are not found

Ah! You must be using the Appium App. For full control over Appium you’ll need to install by NPM or clone the source code. I don’t think the App gives you the flexibility to do the things you want.

Full disclosure: I consider the App a nice “proof of concept” but I would never use it for a serious automation project. Too limiting!

1 Like

ok then, how to store the logs into a String in java ?

I just took a look at the app. Under the Apple menu there is a checkbox for “Show iOS System Log”. Have you tried that?

this option show the system logs but not the logs printed by the app using NSLog (iOS)

Ok. I don’t know how you can get a log from the device like this using the app.

using appium from source ?

As I said above, use the showIOSLog option using source or an NPM install.

Hi, I am trying to get the real device console logs as well.
By setting the capability showIOSLog to true, will this automatically write the logs into my appium.log file? or do I have to do something extra. because right now I dont see those logs in the appium log.
Maybe some hint what else to do?

Thanks Juliane

showIOSLog did not work for me too for real device.:cry: I am using

Appium 1.6.1-beta
Xcode 8.1

I got the solution and now device logs for ios could be fetched. :slight_smile:

Hello @Sonali Can you please share the solution for how to get the appium logs in the java code ?