appium icon indicating copy to clipboard operation
appium copied to clipboard

appium-xcuitest-driver missing debug logs in syslog for simulators

Open johanblumenberg opened this issue 3 years ago • 7 comments

The problem

I am testing a react-native application on the iOS simulator. react-native is forwarding all console logs to syslog, on the appropriate level. I am trying to collect my application log from my tests.

appium-xcuitest-driver has the capability to capture syslog. However, when I read the log files, I can only see logs on Error level. Nothing on Debug or Info level is logged.

This is the code that spawns the log capture process: https://github.com/appium/appium-xcuitest-driver/blob/21ab45fec87ba986820188e7bf4666d6915df6c0/lib/device-log/ios-simulator-log.js#L28 By adding --debug to the log stream command I can make appium-xcuitest-driver include all log levels in the collected logs.

Environment

  • Appium version (or git revision) that exhibits the issue: 1.22.3
  • Last Appium version that did not exhibit the issue (if applicable): N/A
  • Driver version that exhibits the issue (only for Appium2): N/A
  • Last driver version that did not exhibit the issue (if applicable, only for Appium2): N/A
  • Desktop OS/version used to run Appium: OSX 12.3.1
  • Node.js version (unless using Appium.app|exe): v16.13.1
  • Package manager name and version (we only officially support NPM): yarn
  • Mobile platform/version under test: iOS 15.2
  • Real device or emulator/simulator: iPhone 13 simulator
  • Appium CLI or Appium.app|exe: Appium CLI

johanblumenberg avatar May 16 '22 21:05 johanblumenberg

Seems like a great candidate for a pull request to me! (Maybe hidden behind a capability showIosDebugSyslogs or something like that)

jlipps avatar May 16 '22 21:05 jlipps

I assume it's simulator-specific as real devices use a separate logic branch to fetch logs

mykola-mokhnach avatar May 17 '22 04:05 mykola-mokhnach

Hi @mykola-mokhnach ,

In android I am able to fetch the application's API logs present in debug mode but I am not able to fetch the same debug log in iOS, using "syslog". is it any way to fetch debug logs?? It would be very helpful.

ayushsinghcool avatar May 23 '22 11:05 ayushsinghcool

@AYUSH-17 Within a Simulator i can write iOS sysLogs with this to a file : PrintWriter log_file_writer = new PrintWriter(saveDir_syslog); LogEntries logs = driver.manage().logs().get("syslog"); StreamSupport.stream(logs.spliterator(), false).forEach(logXY ->{log_file_writer.println(logXY);}); log_file_writer.flush(); log_file_writer.close();

But my logs show only "ALL" log category. Don't know if this are intresting informations or if there are "DEBUG" log category included

RSM-SBA avatar May 23 '22 11:05 RSM-SBA

Hi @StephanB75 , I am running my test cases on real devices(iOS) as the application that I am using is not compatible with simulator. I am able to capture the syslog but log that I am searching is present only in debug mode.

ayushsinghcool avatar May 23 '22 11:05 ayushsinghcool