Logcat not displaying my log calls

AndroidDebuggingLoggingAndroid Logcat

Android Problem Overview


I'm a total noob at Android programming, and wanted to learn how to debug my apps. I can't seem to have my Log.i|d|v calls displayed in the LogCat.

Here's the code that I'm using. As you can see I have defined a LOG_TAG constant, but can't seem to find it in the LogCat. I have also imported android.util.Log AND I have made sure that in my AndroidManifest I have "debuggable" set to TRUE.

I have also checked http://developer.android.com/reference/android/util/Log.html w/o any luck resolving this issue.

What am I doing wrong? Am I even looking in the right place? I've tried using the DDMS and Debug perspective as well w/o any luck. Any help to this noob would be greatly appreciated. Thanks.

My environment: Windows XP IDE = Eclipse Version: 3.6.1, Build id: M20100909-0800 Emulator = having it point to android sdk 2.1 api 7

//very basic HELLO World code with a couple of Log.i calls

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

public class debugger extends Activity {
	private static final String LOG_TAG = "debugger";
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
    	Log.i(LOG_TAG, "line 13");
    	super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        Log.i(LOG_TAG, "CREATING NOW");
    }
}

Android Solutions


Solution 1 - Android

When using Eclipse, in the DDMS perspective, make sure the correct device (propably emulator-xxxx) is selected and highlighted. Only then will you get the logcat output in the logcat view.

Also, the Android plugin is a bit quircky, and sometimes only shows the last line in the logcat view. If this happens, try to clear the log. After that, you should get all the log entries again (works for me anyway).

Solution 2 - Android

If all else fails:

I did all the above things and couldn't figure out what was wrong,

Test with:

adb logcat

to figure out that my entries were infact in logcat, but twas adt's quirks.

Fix:

> Restart eclipse

This was the only thing that fixed it.

Solution 3 - Android

I've had the same problem using Android Studio and managed to get around by selecting No Filters in the select box in the top right corner of LogCat. By doing this I started receiving everything Android logs in the background into LogCat including my missing Log calls.

enter image description here

Solution 4 - Android

Restart Eclipse and check log cat will be displayed.

Solution 5 - Android

I figured out I was automatically importing com.sileria.Log (from some library project) instead of android.util.Log, where the latter was the correct one. Check your imports as well.

Solution 6 - Android

I've noticed that Eclipse will sometimes throw an exception upon starting an Android app, then LogCat stops updating. I've corrected that by simply restarting Eclipse. I'm not sure if you've tried that and I know it's far from an optimal solution, but I suspect that the Eclipse plugin still has a few bugs to iron out.

Solution 7 - Android

I needed to restart the adb service with the command adb usb

Prior to this I was getting all logging and able to debug, but wasn't getting my own log lines (yes, I was getting system logging associated with my application).

Solution 8 - Android

Easiest way:

Check in your logcat window - TOP RIGHT corner PAUSE button || (Pause receiving new logcat messages)

Few clicks + eventually restart eclipse (usually works in my case)

Solution 9 - Android

On Android Studio: Click on the green arrow pointing to the right to restart the logging; if it is not visible, click on the >> icons to locate it.

Solution 10 - Android

There are a number of reasons why you might not see logs, most of which are listed below. Here are some steps to check most reasons:

  1. Make sure you don't have 'android:debuggable="false"' in your AndroidManifest.xml
  2. Make sure your logcat isn't paused and make sure you are scrolled to the bottom
  3. Your filters should either be 'no filters' or your current app
  4. You have the correct device selected in your logcat devices list
  5. If you're not getting any messages, try restarting adb. You can do that from Android Studio by clicking on the 'restart' icon, it's right after the print icon for logcat and it looks like a green curved arrow coming out of a box. If you don't see it, mouse over the '>>' that continues the icon menu when the logcat is too small.

Solution 11 - Android

I'm a newb as well to Android-Eclipse. Here's what it took for me to get LogCat messages to display in Eclipse: 1: add this to the class in which the logcat message is called: private static final String TAG = "MyActivity"; (per the documentation here)

2: add this Log.i(TAG, "inLayout - finished"); when you where you want to display a message

If the above doesn't work, then shutdonw Eclipse and restart it and rerun your project.

It should then work.

Solution 12 - Android

There is one more thing to watch for:

On the top right side of the logcat there is a dropdown table for filtering messages by type. Make sure it's on the level you are looking for (if it will be on the assert level, it will likely leave your logcat empty).

Solution 13 - Android

Probably it's not be correct, and a little bit longer, but I solved this problem (Android Studio) by using this:

System.out.println("Some text here");

Like this:

try {
       ...code here...
} catch(Exception e) {
  System.out.println("Error desc: " + e.getMessage());
}

Solution 14 - Android

Please go to Task Manager and kill the adb.exe process. Restart your eclipse again.

or

try adb kill-server and then adb start-server command.

Solution 15 - Android

I spent several hours on such case. I saw only touch keys logs. Nothing more. Problem was... smarthphone. After restarting was OK. Disconnecting cable caused problem returned. Had to restart it again. Looks like the Android USB communication is not well designed.

Solution 16 - Android

QUICK FIX.

Just restart the eclipse

Works Perfect.

Solution 17 - Android

Using the SDK 4.0.3 you have to explicitly select it on debug configurations > project > target or else it will never show using Eclipse Indigo (3.7). Of course an eclipse restart ensues.

Solution 18 - Android

I had a problem seeing simple log output in logcat as well. My problem was solved when I installed the latest JDK. I just setup a new development machine and only had the JRE installed and instaling the JDK worked for me.

Solution 19 - Android

None of the other answers worked for me, but this did:

I removed my project from my workspace, then deleted anything that started with a dot (.settings, .project, etc.) from the project folder. Then I re-imported the projected. I'm missing some settings and breakpoints but at least it works.

Solution 20 - Android

I had been experiencing this problem and nothing seemed to work until I moved the log call into a handler. Now it works every time, no matter where you are at.

Solution 21 - Android

I made the mistake of typing in a search term in the logcat search box. I forgot to delete it and hence couldn't see the new logs. Since they didn't match my search term and weren't displayed.

Solution 22 - Android

In my case, I had to remove this line:

    <application
         android:debuggable="false"  <!-- Remove this line -->
         ..../>

From Application tag in my Manifest file.

Solution 23 - Android

Best solution for me was restart adb server (while I have Enabled ADB integration in Android studio - Tools - Android - checked). To do this quickly I created adbr.bat file inside android-sdk\platform-tools directory (where is adb.exe located) with this inside:

adb kill-server
adb start-server

Because I have this folder in PATH system variable, always when I need restart adb from Android studio, I can write only into terminal adbr and it is done.

Another option to do this is through Android Device Monitor in Devices tab - Menu after click on small arrow right - Reset adb.

Solution 24 - Android

For eclipse:

  1. Go to ddms perspective.
  2. Make sure that correct device is selected.
  3. If already selected and not displaying logs, then restart ABD.
  • Hope this will solve.

Solution 25 - Android

I restarted the ADB service as well with "adb usb" and fixes the problem for me. In fact, only one of my activities didn't log anymore. All the others did log stuff. After restart adb everything works like a charm again. For the other people who're searching for another solution: adb kill-server, adb start-server in CLI will often fix your problem aswell.

Solution 26 - Android

make your app force close once this will start LogCat again ...

use this for force close :D

setContentView(BIND_AUTO_CREATE);

Solution 27 - Android

some times the problem is not from pc on the other hand IDE,ADB etc, but it arises from your device that doesn't send logs to ADB so if you tried all the ways mentioned before and still your logcat is empty try to restart your device and try again.I tried all the ways mentioned above and neither of them worked but after a restart on my phone logcat worked like magic

Solution 28 - Android

I have this problems and fixed, String TAG without space:

"my tag" // noting show
"my_tag" // is ok

Solution 29 - Android

In my case I just had to add a name to the String. In first instance I just had a space in between the brackets

private static final String TAG = " ";

but after adding a name it worked perfectly.

private static final String TAG = "oncreate";

Solution 30 - Android

After upgrade to Android 3.6.1, I have experienced this issue multiple times. The only thing that works in my case is RESTARTING THE DEVICE.

Solution 31 - Android

You're trying to put Running Code on Working space.. so try to put your code on running code..

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionCavachonView Question on Stackoverflow
Solution 1 - AndroidddewaeleView Answer on Stackoverflow
Solution 2 - AndroidDheeraj BhaskarView Answer on Stackoverflow
Solution 3 - AndroidCIRCLEView Answer on Stackoverflow
Solution 4 - AndroidanjaneyaView Answer on Stackoverflow
Solution 5 - AndroidMarek WalasekView Answer on Stackoverflow
Solution 6 - AndroidMike YockeyView Answer on Stackoverflow
Solution 7 - AndroidJim RushView Answer on Stackoverflow
Solution 8 - AndroidfiderView Answer on Stackoverflow
Solution 9 - AndroidEd_View Answer on Stackoverflow
Solution 10 - AndroidDavid Ljung Madison StellarView Answer on Stackoverflow
Solution 11 - AndroidJazzmineView Answer on Stackoverflow
Solution 12 - AndroidItai HanskiView Answer on Stackoverflow
Solution 13 - AndroidSergei MaslovskiyView Answer on Stackoverflow
Solution 14 - AndroidArghyaView Answer on Stackoverflow
Solution 15 - AndroidAlex BurtonView Answer on Stackoverflow
Solution 16 - AndroidAli AkramView Answer on Stackoverflow
Solution 17 - AndroidLuis RoblesView Answer on Stackoverflow
Solution 18 - AndroidJeff LaFayView Answer on Stackoverflow
Solution 19 - AndroidrmooneyView Answer on Stackoverflow
Solution 20 - Androida54studioView Answer on Stackoverflow
Solution 21 - AndroidBilbo BagginsView Answer on Stackoverflow
Solution 22 - AndroidnmvictorView Answer on Stackoverflow
Solution 23 - AndroidAtirisView Answer on Stackoverflow
Solution 24 - AndroidKarthikView Answer on Stackoverflow
Solution 25 - Androiduser443346View Answer on Stackoverflow
Solution 26 - Androiduser4254398View Answer on Stackoverflow
Solution 27 - AndroidCode_WormView Answer on Stackoverflow
Solution 28 - AndroidjahangiriView Answer on Stackoverflow
Solution 29 - AndroidPopulus_TremulaView Answer on Stackoverflow
Solution 30 - AndroidPablo AlfonsoView Answer on Stackoverflow
Solution 31 - AndroidshabeerView Answer on Stackoverflow