question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android Logcat is not getting captured and the "getLogTypes" request is failing

See original GitHub issue

The problem

Whenever I run an emulated Android device using Appium, the logcat file used to be created in my ./log directory. Just recently, those files are not being created per session, and I am not able to see log types either using the method that issues the request for device log types.

Environment

  • Appium version (or git revision) that exhibits the issue: 1.20.2 (using package “@wdio/appium-service@^6.12.1”)
  • Last Appium version that did not exhibit the issue (if applicable): 1.18.x
  • Desktop OS/version used to run Appium: macOS Big Sur 11.6.1
  • Node.js version (unless using Appium.app|exe): 12.20.1
  • Npm or Yarn package manager: Yarn 1.22.10
  • Mobile platform/version under test: Android OS 11.0 (API 30)
  • Real device or emulator/simulator: Emulator
  • Appium CLI or Appium.app|exe: Appium CLI Edit: not sure if important, but I also have Android tools installed with Android Studio Arctic Fox 2020.3.1 Patch 3.

Also, I am using WebDriverIO version 6.12.1 to launch Appium, but it also fails with WebDriverIO v7.

Details

Android logcat files are not being created at the start of the session. My device capabilities are below:

    {
        'appium:locale': 'US',
        'appium:language': 'en',
        'appium:deviceName': "pixel_3a",
        'appium:avd': "Pixel_3a_API_30",
        'appium:platformVersion': "11.0", //API 30
        'appium:app': 'path/to/my-app.apk',
        'appium:printPageSourceOnFindFailure': true,
        excludeDriverLogs: ['bugreport', 'performance'],
        platformName: 'Android',
        maxInstances: 1,
        'appium:orientation': 'PORTRAIT',
        'appium:automationName': 'UiAutomator2',
        'appium:noReset': false,
        'appium:fullReset': true,
        'appium:allowTestPackages': true,
        'appium:newCommandTimeout': 240,
        'goog:chromeOptions': {
            'args': ['--disable-fre', '--no-first-run', '--no-default-browser-check']
        }
    };

As well, the endpoints for retrieving both device log types and device logs fail:

  • GET /session/:session_id/log/types
  • POST /session/:session_id/log

Link to Appium logs

2021-11-16T15:31:29.839Z INFO webdriver: COMMAND getLogTypes()
2021-11-16T15:31:29.839Z INFO webdriver: [GET] http://localhost:4723/wd/hub/session/b2d7848b-dba4-44fa-a603-809f7c11dc79/se/log/types
2021-11-16T15:31:29.846Z WARN webdriver: Request failed with status 404 due to The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource

Code To Reproduce Issue [ Good To Have ]

I am using WebDriverIO with a Cucumber framework configuration.

Firstly, launch WebDriverIO with an Android device, and then running this code will cause the failure:

const logTypes = await driver.getLogTypes();

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mykola-mokhnachcommented, Nov 18, 2021

You could switch to Appium 2. There drivers are decoupled from the server code, so it is possible to install whenever driver version is needed without touching server modules.

1reaction
KazuCocoacommented, Nov 17, 2021

ah, i see. probably we need to add the se route in https://github.com/appium/appium-uiautomator2-driver/blob/master/lib/driver.js#L70 as well for some drivers.


Is there a way I can force the old /session/:session_id/log/types and /session/:session_id/log/ path for logs?

This is client side one. I don’t know if webdriverio can it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - Logcat not displaying my log calls - Stack Overflow
I've had the same problem using Android Studio and managed to get around by selecting No Filters in the select box in the...
Read more >
Accessing Android Logcat Logs with Appium - HeadSpin
Find out how you can use Appium to access logs that the Android system records using a tool called logcat.
Read more >
Logcat command-line tool - Android Developers
Logcat is a command-line tool that dumps a log of system messages when the device throws an error and sends messages that you...
Read more >
Troubleshooting - Appium
General · Make sure you've followed the getting started steps in the README · Make sure your system is set up appropriately (i.e.,...
Read more >
getLogTypes | API Reference - Nightwatch.js
Callback function which is called with the result value. Returns. Type, description. Array, Available log types. Usage.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found