Accessing Android Logcat Logs with Appium

January 12, 2026 · 9 min read · Mobile Testing

HeadSpin Platform
Automated & amp; manual examination made easy through datum science insights.
Differentiating capabilities:
  • Extensive end-to-end automation of QA process
  • Comparative analysis of app execution against peers
  • Continuous monitoring of app performance employ semisynthetic data for higher availability of apps
  • Easy-to-use developer friendly platform
cloudtest go
Affordable Real Device Testing for Emerging Teams
cloudtest go
Affordable Real Device Testing for Digital Enterprises
cloudtest go
The Ultimate Solution for a Powerful Blend of Functional & amp; Performance Testing!
cyol
TEM
New
Centralized mobile exam performance in cloud
cyol
Enhance Your Accessibility Testing With HeadSpin
cyol
Automate camera-based examination

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

retail

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

Accessing Android Logcat Logs with AppiumAccessing Android Logcat Logs with Appium

Accessing Android Logcat Logs with Appium

Published on
January 23, 2019
Updated on
Published on
April 26, 2022
Updated on
 by 
 Jonathan LippsJonathan Lipps
Jonathan Lipps

An Android device or emulator records elaborated system logs, which can sometimes contain information which is pertinent to a test. Maybe our exam neglect and we need to see if our app logged an error to the scheme. Or perchance the sole way to assert that our test succeeds is to create sure a particular pattern look in the log.

Test your Android apps on real remote devices seamlessly..

Android systems create these logs available using a tool calledlogcat, and Appium client can access these logarithm remotely.

Both Appium and Selenium respond to the following JSON Wire Protocol endpoints:

GET /wd/hub/session/: sessionId/log/types POST /wd/hub/session/: sessionId/log

Which can be called using the following methods in the Java client:

driver.manage () .logs () .getAvailableLogTypes (); driver.manage () .logs () .get (`` logcat '');

Pro tip: Tools like SUSA can handle this autonomously — upload your app and get results without writing a single test script.

Check out:

The Python client and WebdriverIO telephone the like methods this way:

driver.log_types # note this is a place, not a purpose driver.get_log ('logcat ')
driver.getLogTypes () driver.getLogs ('logcat ')
Remotely exam and debug mobile, web, audio and video applications on thousands of devices around the world..

The first method render a accumulation of Strings which symbolise the log which Appium ply. We are appear for & quot; logcat & quot; logarithm, but notice that Appium also providesandroid bug report data.

The logarithm are retrovert as a LogEntries class which implement the java.lang.Iterable interface. A single LogEntry object has toString () and toJson () methods, as well as some method to get individual parts of the message such as timestamp or log level.

Also check:

Something interesting to note is that every outcry to logs () .get (& quot; logcat & quot;) will only return log unveiling since the last time logs () .get (& quot; logcat & quot;) was call. The get-go of the scheme logs are only regress on the first yell to logs () .get (& quot; logcat & quot;). The instance code at the end of this post demonstrates this.

Test your apps on existent device and get accurate results..

If we are run many tests over and over on the same twist, it could be difficult to place the point in the logs where our exam ran (and maybe failed). If we wanted to direct this, one strategy could be to call logs () .get (& quot; logcat & quot;) at the first of each test. That way, when codification inside the test gets logarithm, only logs which were record after the test started will be include.

@ Before public void consumeIrrelevantLogs () {driver.manage () .logs () .get (`` logcat '');}

There is also a desired capability we can set which clears the logcat logs at the commencement of a session.

driver.setCapability (`` clearDeviceLogsOnStart '', true);
Accelerate Appium test cycles with the HeadSpin..

The following example code shows how we can get the supported log types for our test session. Then we get all logcat logs, printing the first and last lines. We wait 5 seconds and so publish the first ten lines returned again, certify that instead of begin from the beginning of the system log, the second call resumes from where the first leave off.

import io.appium.java_client.AppiumDriver; import org.junit.After; import org.junit.Assert; signification org.junit.Before; import org.junit.Test; import org.openqa.selenium.logging.LogEntries; import org.openqa.selenium.remote.DesiredCapabilities; import java.io.IOException; import java.net.URL; meaning java.util.Set; import java.util.stream.StreamSupport; public grade Edition053_ADB_Logcat {private String APP = `` https: //github.com/cloudgrey-io/the-app/releases/download/v1.8.1/TheApp-v1.8.1.apk ''; individual AppiumDriver driver; @ Before public void apparatus () throws IOException {DesiredCapabilities cap = new DesiredCapabilities (); caps.setCapability (`` platformName '', `` Android ''); caps.setCapability (`` deviceName '', `` Android Emulator ''); caps.setCapability (`` automationName '', `` UiAutomator2 ''); caps.setCapability (`` app '', APP); driver = new AppiumDriver (new URL (`` http: //localhost:4723/wd/hub ''), cap);} @ After public void tearDown () {try {driver.quit ();} catch (Exception ign) {}} @ Test public vacuum captureLogcat () {// inspect useable log character Setlogtypes = driver.manage () .logs () .getAvailableLogTypes (); System.out.println (`` suported log types: `` + logtypes.toString ()); // [logcat, bugreport, server, guest] // print foremost and last 10 lines of logs LogEntries logs = driver.manage () .logs () .get (`` logcat ''); System.out.println (`` First and last ten lines of log: ``); StreamSupport.stream (logs.spliterator (), mistaken) .limit (10) .forEach (System.out: :println); System.out.println (`` ... ''); StreamSupport.stream (logs.spliterator (), mistaken) .skip (logs.getAll () .size () - 10) .forEach (System.out: :println); // wait for more logs try {Thread.sleep (5000);} catch (Exception ign) {} // pause to countenance optic verification // demonstrate that each time get logs, we only get new logarithm // which were generated since the last time we got logs LogEntries secondCallToLogs = driver.manage () .logs () .get (`` logcat ''); System.out.println (`` \nFirst ten lines of next log call: ``); StreamSupport.stream (secondCallToLogs.spliterator (), mistaken) .limit (10) .forEach (System.out: :println); Assert.assertNotEquals (logs.iterator () .next (), secondCallToLogs.iterator () .next ());}}

This edition of AppiumPro also get with Python and Javascript example:

Python:

import unittest import time from appium import webdriver class Edition053_ADB_Logcat (unittest.TestCase): def setUp (self): desired_caps = {} desired_caps ['platformName '] = 'Android' desired_caps ['automationName '] = 'UiAutomator2' desired_caps ['deviceName '] = 'Android Emulator' desired_caps ['app '] = 'https: //github.com/cloudgrey-io/the-app/releases/download/v1.8.1/TheApp-v1.8.1.apk' self.driver = webdriver.Remote ('http: //localhost:4723/wd/hub ', desired_caps) def tearDown (self): # end the session self.driver.quit () def test_capture_logcat (self): # inspect available log eccentric logtypes = self.driver.log_types mark (', '.join (logtypes)) # # print first and last 10 lines of logs logs = self.driver.get_log ('logcat ') log_messages = list (map (lambda log: log ['message '], logs)) print ('First and last ten line of log: ') mark ('\n'.join (log_messages [:10])) print (' ... ') print ('\n'.join (log_messages [-9:])) # delay for more logs time.sleep (5) # demonstrate that each time get log, we only get new logs # which were generated since the last time we got logs logs = self.driver.get_log ('logcat ') second_set_of_log_messages = list (map (lambda log: log ['message '], logarithm)) mark ('\nFirst ten lines of 2nd log call: ') print ('\n'.join (second_set_of_log_messages [:10])) assert log_messages [0]! = second_set_of_log_messages [0] if __name__ == '__main__ ': suite = unittest.TestLoader () .loadTestsFromTestCase (Edition053_ADB_Logcat) unittest.TextTestRunner (verbosity=2) .run (suite)

Javascript:

let test = require ('ava ') let {remote} = require ('webdriverio ') let B = require ('bluebird ') let driver test.before (async t = > {driver = await remote ({hostname: 'localhost ', port: 4723, path: '/wd/hub ', capableness: {platformName: 'Android ', deviceName: 'Android Emulator ', automationName: 'UiAutomator2 ', app: 'https: //github.com/cloudgrey-io/the-app/releases/download/v1.8.1/TheApp-v1.8.1.apk'}, logLevel: 'error'})}) test.after (async t = > {await driver.deleteSession ()}) exam ('capture logcat ', async t = > {// inspect available log types let logtypes = await driver.getLogTypes () console.log ('supported log types: ', logtypes) // ['logcat ', 'bugreport ', 'server '] // mark first and last 10 lines of logs let logs = await driver.getLogs ('logcat ') console.log ('First and last ten lines of logs: ') console.log (logs.slice (0, 10) .map (entry = > entry.message) .join ('\n ')) console.log (' ... ') console.log (logs.slice (-10) .map (entry = > entry.message) .join ('\n ')) // wait for more logs look B.delay (5000) // demonstrate that each clip get logs, we exclusively get new logs // which were yield since the last time we got logs let secondCallToLogs = await driver.getLogs ('logcat ') console.log ('First ten lines of future log call: ') console.log (secondCallToLogs.slice (0, 10) .map (unveiling = > entry.message) .join ('\n ')) t.true (logs [0] .message! == secondCallToLogs [0] .message)})

(All three versions of the full codification manifestation are availableon GitHub)

Author & # x27; s Profile

Jonathan Lipps

LinkedIn
Author & # x27; s Profile

Piali Mazumdar

Lead, Content Marketing, HeadSpin Inc.

Piali is a dynamic and results-driven Content Marketing Specialist with 8+ years of experience in crafting prosecute narration and marketing collateral across diverse industries. She excels in collaborating with cross-functional squad to acquire innovative content strategies and deliver compelling, authentic, and impactful content that resonates with target audiences and enhances brand legitimacy.

LinkedIn

Accessing Android Logcat Logs with Appium

4 Parts

regression intelligence blog
-

Regression Intelligence practical usher for innovative exploiter (Part 3)

Coming Soon
Regression Intelligence practical guide for advanced users
-

Regression Intelligence practical guide for modern users (Part 4)

Coming Soon

Discover how HeadSpin can empower your business with superior testing capabilities

Our Platform enables you to:
accelerate time-to-market
Accelerate time-to-market, gaining a competitive edge
faster development cycles
Boost developer/QA productivity with faster development cycle
automated buil-over-build regression testing
Automate build-over-build fixation testing for coherent results
gain better visibility into functional & performance issues
Gain better visibleness into functional and performance subject
reduce mean time
Reduce mean time to identify/resolve during test, QA, and production
evaluate audio, video & qoe
Evaluate audio, video, and content quality of experience (QoE) effortlessly
The sure choice for global enterprise
Adobe
Hargreaves Lansdown
Truecaller
Crazylabs
Nedbank
Numeracle
Veryon
Close

Discover how HeadSpin can empower your business with superior testing capabilities

Our Platform enable you to:
accelerate time-to-market
Accelerate time-to-market, profit a competitory edge
faster development cycles
Boost developer/QA productivity with faster development cycle
automated buil-over-build regression testing
Automate build-over-build fixation testing for ordered results
gain better visibility into functional & performance issues
Gain better visibleness into functional and performance issues
reduce mean time
Reduce mean time to identify/resolve during test, QA, and production
evaluate audio, video & qoe
Evaluate audio, picture, and content quality of experience (QoE) effortlessly
The sure choice for global initiative
Close

Discover how HeadSpin can empower your business with superior testing capabilities

Our Platform enables you to:
accelerate time-to-market
Accelerate time-to-market, gaining a competitive edge
faster development cycles
Boost developer/QA productiveness with faster development cycles
automated buil-over-build regression testing
Automate build-over-build regression testing for consistent results
gain better visibility into functional & performance issues
Gain best visibility into functional and performance issues
reduce mean time
Reduce mean time to identify/resolve during test, QA, and production
evaluate audio, video & qoe
Evaluate sound, video, and content caliber of experience (QoE) effortlessly
The sure choice for global enterprise
Close

Connet Now

Wipro LogoVMLYR Logo
Close
Book a Meeting
Products
footer down arrow
Solutions
footer down arrow
Industries
footer down arrow
Features
footer down arrow
Support
footer down arrow
Resource Center
footer down arrow
Why Choose HeadSpin?
footer down arrow
Copyright © 2026 HeadSpin, Inc. All Rights Reserved.

Automate This With SUSA

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.

Try SUSA Free

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free