How to Get a Logcat for Reporting Bugs on Android

Matthew Hughes 29-02-2016

Android does a really good job of hiding the nitty-gritty from its users. When things go wrong, you don’t see an intimidating wall of cryptic text, much like you do on a Mac. They just… Go wrong.



While that’s great for most people, it’s less helpful for developers who want to see why their apps aren’t working, and for power users who want to take a more hands-on approach.

Which is why logcat is so incredibly helpful. It allows you to get a dump of your phone or tablet’s system logs in order to debug problems. Although most users won’t have a use for it, developers will sometimes ask users to provide them with their device’s log files when a problem arises. Here’s how you can install logcat, and how to use it.

Getting Logcat

Before you start producing system logs, you’re first going to need to fulfill some prerequisites. The first is to install the Android Debug Bridge, commonly known as ADB New To Android Debug Bridge? How To Make The Process Simple And Easy ADB is incredibly useful for sending commands to your Android device from your computer. For the beginners out there, here's a dead simple way to use ADB. Read More . This contains the Logcat tool.

If you’re on a Mac, like I am, the simplest way to do this is using the HomeBrew package manager How to Install Mac Apps in Terminal Using Homebrew Did you know you can install Mac software in the Terminal? Here's how to use Homebrew to install Mac apps easily. Read More . Once installed, you just need to run “brew install android-platform-tools”.



If you’re on Linux, the steps required to install ADB will vary wildly between distributions. If you’re on Ubuntu, you just need to run “sudo apt-get install android-tools-adb”.

Finally, if you’re on Windows, you’ve got a couple of options. First, XDADevelopers has a one-click ADB installer, which includes the drivers needed and FastBoot. Alternatively, you can install it through the Chocolatey package manager, although the version available isn’t the newest.

Put Your Device Into Developer Mode

Next, you’re going to enable developer mode on your device. To do that, open your settings and head to “About Phone” or “About Tablet”. Then, scroll down to the bottom of the screen and tap “Build Number” seven times. Once you’ve done that, it should tell you that you’ve entered Developer Mode.



Press back and go to the Settings root directory, where you should see something that says “Developer Options”. Tap that.


Then, switch USB Debugging on What Is USB Debugging Mode on Android? Here's How to Enable It Need to allow USB Debugging on your Android? We explain how to use debugging mode for pushing commands from your PC to your phone. Read More  and plug your Android device into your computer. If everything worked alright, you should see a stern-looking warning pop up on your device.



Looking At Logs

Now we can start looking at logs. Open up a new terminal or command prompt, and run “adb logcat”. You should then see system messages cascade down your terminal window. If you don’t, that means something’s gone wrong. Either your device isn’t connected to your computer, ADB wasn’t installed correctly, or you don’t have USB debugging running on your device.


So, what if you want to copy your phone or tablet’s system messages to a text file, for later analysis? Well, the syntax for redirecting output is the same on Windows as it is on a Mac. Just run “adb logcat > textfile.txt”. You can also accomplish this by running “adb logcat -f filename”.


Once you’ve got the log file, you can parse it using Sed and Awk Every Linux Geek Needs To Know Sed and Awk. Here's Why... Two of the most criminally under-appreciated Linux utilities are the admittedly arcane Sed and Awk. But what are they? How are they used? And how do they make it easier to process text? Read More  or Grep, or you can just send it off to the developer who requested it.

It’s worth pointing out that logcat will run for as long as you tell it to. If you’re copying output to a text file and forget to end the connection, you shouldn’t be surprised if you end up with no hard drive space. To close it, just press CTRL-C.

As anyone who has ever worked in DevOps or systems administration will tell you, log files can quite easily stretch into the tens of gigabytes, and beyond. You’ve been warned.

A Note On Filtering Output

It’s worth noting that you can tell logcat to prioritize certain types of output. If you run logcat with the “V” flag (“adb logcat V”), you’ll see absolutely everything. That’s because you’ve enabled “verbose mode”.


But there are other triggers which show you more specific types of error messages. The “I” trigger only shows you info, while “D” shows debug messages. For more information, check out the official Android Debug Bridge documentation.

Although, it’s worth noting that unless you’ve been told otherwise, it’s best to run logcat using the default settings. This is so that the person who has requested the log file can get all the information they need to fix their app, and they don’t miss anything.

Is There A Solution For Rooted Devices?

Actually, yes! If you’ve got a rooted phone or tablet, you can install “aLogCat” from the Google Play Store. This comes in a free version, and a paid version. Both are identical, although the latter supports the developer financially.


What makes aLogCat different is that it runs directly on your device, and comes with some features that make it easier to deal with error logs.

Messages are highlighted, allowing you to visually see which messages are errors, and what are innocuous system notifications. You can also share them through email, bluetooth, and on PasteBin via PasteDroid.

If you want to continuously save your logs directly to an SD card, you’ll have to download a different application called aLogRec. This too comes in a free version and a donate version, and it can be acquired from the Google Play Store.


But what if you want to view and edit the log files directly on your phone? For that, I recommend Vim Touch, which is a free mobile version of the VIM text editor The Top 7 Reasons To Give The Vim Text Editor A Chance For years, I've tried one text editor after another. You name it, I tried it. I used each and every one of these editors for over two months as my primary day-to-day editor. Somehow, I... Read More . I first wrote about this a few years ago, when discussing the best ways to set up a PHP development environment on an Android device Create The Perfect PHP Development Environment In Android Using a ghastly virtual keyboard to write a Facebook status update is bad enough. Writing code on Android? Perish the thought. Read More .

Before we wrap things up, I want to point out that rooting your phone can result in your phone being more susceptible to malware, and certain applications (especially banking applications) not working.

If you’re considering rooting your device The Complete Guide to Rooting Your Android Phone or Tablet So, you want to root your Android device? Here's everything you need to know. Read More just to get at your log files, I strongly recommend you use the tethered, ADB-based approach instead. It’s just as easy, and way more secure.

Over To You!

Have you ever had to get hold of your phone or tablet’s system log? How come? Did you find it easy? Which method did you use? Let me know in the comments below.

Explore more about: Android Customization, Android Rooting.

Whatsapp Pinterest

Enjoyed this article? Stay informed by joining our newsletter!

Enter your Email

Leave a Reply

Your email address will not be published. Required fields are marked *