简体   繁体   中英

Appium - How to read log from iOS device using java

I am trying to automate iOS app testing using appium and java. I was able to read log files generated for simulators at /Users/xyz/Library/Logs/CoreSimulator/158d9eddabcdefyt586a334136/system.log

Where can i find the log when I am running a test on real device? I see the only way to do so is on xcode for now.

Has anybody faced this issue and can guide me ?

This might be helpful[works in Android for sure] :

List<LogEntry> logEntries = driver.manage().logs().get("logcat").getAll();            
for (LogEntry entry : logEntries) {
     if (entry.getMessage().contains(event)) { //
          System.out.println("Found the logs looking for.");          
       }
}

Digging in further I could find this which might be of some help in the course :

package io.appium.java_client.service.local.flags;
public enum IOSServerFlag implements ServerArgument{
...
    /**
     * if set, the iOS system log will be written to the console<br/>
     * Default: false
     */
    SHOW_IOS_LOG("--show-ios-log"),
...
}

Its also here : http://appium.io/slate/en/master/?ruby#server-flags

If you want to see the logs then you can use libimobiledevice library or lemonjar. Libimobiledevice is quite better then lemonjar.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM