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


#1

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


#2

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

http://appium.io/slate/en/master/?java#ios-only


#3

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


#4

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.


#5

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


#6

and how to get the appium logs in java ?


#7

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


#8

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


#9

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


#10

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!


#12

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


#13

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?


#14

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


#15

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


#16

using appium from source ?


#17

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


#18

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


#19

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

Appium 1.6.1-beta
Xcode 8.1
iOS10


#20

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


#21

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