Asked  7 Months ago    Answers:  5   Viewed   36 times

I observed that when i use Logcat with Eclipse with ADT for Android, I get messages from many other applications as well. Is there a way to filter this and show only messages from my own application only.



Package names are guaranteed to be unique so you can use the Log function with the tag as your package name and then filter by package name:

NOTE: As of Build Tools 21.0.3 this will no longer work as TAGS are restricted to 23 characters or less.

Log.<log level>("<your package name>", "message");

adb -d logcat <your package name>:<log level> *:S

-d denotes an actual device and -e denotes an emulator. If there's more than 1 emulator running you can use -s emulator-<emulator number> (eg, -s emulator-5558)

Example: adb -d logcat com.example.example:I *:S

Or if you are using System.out.print to send messages to the log you can use adb -d logcat System.out:I *:S to show only calls to System.out.

You can find all the log levels and more info here:

EDIT: Looks like I jumped the gun a little and just realized you were asking about logcat in Eclipse. What I posted above is for using logcat through adb from the command line. I'm not sure if the same filters transfer over into Eclipse.

Tuesday, June 1, 2021
answered 7 Months ago

Typecast ServletRequest into HttpServletRequest (only if ServletRequest request is an instanceof HttpServletRequest).

Then you can use HttpServletRequest.getHeader() and HttpServletRequest.getHeaderNames() method.

Something like this:

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
    HttpServletRequest httpRequest = (HttpServletRequest) request;
    Enumeration<String> headerNames = httpRequest.getHeaderNames();

    if (headerNames != null) {
            while (headerNames.hasMoreElements()) {
                    System.out.println("Header: " + httpRequest.getHeader(headerNames.nextElement()));

    chain.doFilter(httpRequest, response);
Sunday, August 8, 2021
answered 4 Months ago

Same problem here with Android Studio 1.0 RC2. The Device Monitor shows the application name but in Android Studio's logcat panel, the package name is always a question mark.

I fixed the problem by Checking Tools / Android / Enable ADB Integration and then restarting adb.

A simpler way to is to Debug any app, if ADB integration is disabled, Android Studio will prompt you to enable.

You have to enable ADB integration to launch debugging. Do you want to do that?

Click Yes, of course.

Monday, August 9, 2021
answered 4 Months ago

Is that normal?

Yes - the system itself as well as every app uses logging and that's what you're seeing. A bare-bones emulator won't have many apps with receivers and services running so you won't see the same amount of logging.

How can I fix this problem?

You can't as such but you can reduce it by force closing various apps from "Settings" on the device. Not necessarily a good idea but it's your choice.

You can improve things by using package TAGs in your code and then applying a filter to only show logcat data with your TAGs.


package com.mycompany.mypackage

public class MyActivity extends Activity {

    protected final String TAG = getClass().getName();


In the above TAG will be "com.mycompany.mypackage.MyActivity". Use protected as the modifier so any classes which extend MyActivity will automatically assign their own class name to TAG.

When logging you just use `Log.d(TAG, "Some text");

You then just need to filter on "com.mycompany.mypackage" to only see logging from your own app components.

Tuesday, August 24, 2021
answered 4 Months ago

I want to reach id of selected radio button from this code.

You have to play with setTag & get getTag property to fetch actual id of your selected radio button,


holder.button.setOnClickListener(new View.OnClickListener() {  
                public void onClick(View v) {   
                 int pos = (Integer) v.getTag();
                 Log.i("ID of radiobutton","Order Edit @ position : " + pos); 
                 String _Str1=array1.get(pos);
                 String _Str2=array2.get(pos);

This way you will get the exact values of textview from your rows.

Saturday, August 28, 2021
answered 3 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :