Eclipse Logcat goes crazy - android

I was using my Eclipse Logcat crazy normally until yesterday where it started displaying messages without stop.
My message that I am printing using log.d are no longer printed to the log.
Or maybe they are but because of the huge number of messages printed they are gone.
The messages do not stop printing to the log whether I am using the app or not.
The only way to stop it is to unplug my device from the PC otherwise the messages will keep flushing to the logcat
Any suggestions ?
Thanks in advance :)

It sounds like you have no filtering of the log output and therefor sees output for every app on the phone.
Create a logcat filter with your application package name.
In the logcat window, go to "Saved filters", create a new one (if Eclipse hasnĀ“t autocreated one for you) by clicking plus-sign to add. Type a name of your filter and write your application package name under "by Application Name". Click "ok".
When you select it you only see logcat outputs for your specified app.

Related

Android Studio 3.0 Logcat continuously showing messages and does not stop

When I start debugging my App in Android Studio 3.0 and open the Logcat, it displays so many messages and warnings, but the problem is, it never stops, even when the debugging is completed and the App is terminated, it still prints so many messages continuously.
Can anybody help???
Since you are not debugging or running any application on the device you have connected. Hence, the logcat is displaying the logs generated by all the apps in the device as well as the system logs. Which makes the log cat window go nuts.
What you can do is.
On the top right corner of the log cat window, there is a filter config combo box. Select or create a filter of your own to filter out relevant logs.
The filter could be created using any details, it could be a process ID (PID), the tag name e.g I/ActivityManager: where I stands for Info, V for Verbose, D for Debug and so on.
You can add filter in your Logcat, and mention all the classes whose logs you want to discard.
In the field LogTag (shown in the pic) define a regex like this ^(?!Class A | Class B|#). Here Class A and Class B are the classes whose logs you don't want to see.That's it.
If you see no debuggable application then change it to your app name. If that wont help change the log level to error. Last thing you can try is to filter the results. Good luck!

Logcat is being "spammed", resulting in "Too much output to process"

Whenever I connect my Samsung Galaxy S5 (running Android 4.4.2) to my computer, the Logcat in Android Studio starts being "spammed" by the same message multiple times ~1600 times per second, resulting in the message "Too much output to process" appearing in a yellow box in Logcat. This is when there is no filtering and no debug process selected.
The Logcat message is this:
D/tms_audio_hw/AudioTmsIpc AudioTmsClientListen accept Done gAudioClientAcceptSockFd -1 gAudioClientLocalSockFd 24
Googling it reveals surprisingly little. Actually nothing. I'm not sure, but it seems to be affecting the logging from my application as well, because when I select my application as the debug process, I don't get all the Logcat outputs from my application - sometimes I'll get some, sometimes I'll get others, sometimes I'll get none.
Also, because of this my computer starts using CPU like crazy just to process those messages, resulting in extreme CPU usage and fans at full blast!
What the heck is causing this?
EDIT
I have now looked at exactly how fast these logs are coming in, and it's at a rate of 1600 logs per second, and it's just this same message over and over and over. Don't tell me this is "normal behaviour" unless you are experiencing this on your own devices.
You may have selected "No Filters" in android monitor which causes "Too much output to process error", Change it to "Show only selected Application" then all other Log line are filtered and will not show in Logcat.
Here is snapshot of Android Monitor.
I had a similar problem while testing an app. Initially the log messages displayed as expected and then it started to display my log messages "at random", i.e. showing and then not showing.
Removing the Logcat filter showed the "too much output to process" message. I also noticed that the log was displaying messages relating to apps installed on my phone (I was using a phone to test my app) and had nothing to do with my app.
I disconnected the phone from my laptop, restarted the phone and then re-connected it back to the laptop and ran the app. The Logcat was back to normal, showing the log messages as expected.
That is normal behaviour; it is not related to a particular phone model or Android OS version. When you remove all filters, there's just too much logging output being redirected from everything that can and does log, including system components and various libraries that are loaded at that time.
The recommended default approach is to simply filter out and view only your application's log output and switch to no filtering only when you are specifically debugging something where you need to know what else is happening around that part of code.

LogCat won't show my logs

I've searched for similar problems, but I didn't find anything useful - I'm working with eclipse, and I can't see my Logs.
The device is connected properly, the app runs and does what it's supposed to do, but I get no logs from it.
I get other logs messages from the device, not the ones that I print, e.g. Log.d("SMS", "hello"). On the other hand, if I use the statement System.out.println("hello"), I do see it, tagged as System.out.
I've tried to disconnect and reconnect the device, restart it, close and open eclipse, choose the device from Device window. It happens both with a 'real' device and an emulator. I've also tried to remove the filtering, but nothing helps - I still don't get the logs.
Okay, I've found the problem -
Apprently there are some illegal tags, and I've used one of them.
My app is spam SMS blocker, and I've used the tag SMS. If I change it to another tag (like SMSBlocker) it suddenly appears in the LogCat.
Check if your project is using proguard.
Basically proguard will remove all the debug logs and optimize your code while creating apk.
Try adding proguard.enabled=false in your project.properties
I think you should use TAG.
When you log from your android app, the first parameter is a TAG string. So if you set it up to a unique string (like your app name) then you can later filter by it in Eclipse.
Example : Log.e(TAG, "state error");

How to print a string to logcat for testing?

I know this question has been asked before, but I can't find a clear answer. I'm new to Android Studio and the logcat console confuses me. I have a string date and I want to keep 'track' of it in the console so I know what value it has.
I tried commands like Log.i and console.log, but they don't seem to work for me.
Where should I write my print line code?
Where can I see it when it gets printed?
Do I have to run the whole app (on the emulator, or on a device) to print the line to the console?
Where do I write my print line code ?
That is up to you.
Where can I see it when it gets printed ?
In LogCat:
You will get this from the Android view (usually docked on the bottom edge on the left side). Note that I have sometimes encountered a bug where the automatically-applied filter for your app (right-hand drop-down list, above the output) seems to result in nothing showing up in the output. You may need to remove the filters, then adjust the output based on log level.
You can also view LogCat at the command line via adb logcat and in the Android Device Monitor (Tools > Android > Android Device Monitor from the Android Studio main menu).
Do I have to run the hole app (emulator or via a device) to print the line to the console?
Yes.
Your use of Log.i is the correct way to write to Logcat. Here is the documentation for Log.
I typically use a tag that describes the stage I am in (setup, teardown, UI update, etc), and I will usually log any action that can trigger an exception.
To view the Logcat, there should be a window for that in Android Studio. When the windows is not visible, you can access it from a tab in the lower left corner of the screen:
if you want to show logs in error
you can write
Log.e("Your Tag for identy", "Your String ");
if you want to show logs in info
you can write
Log.i("Your Tag for identy", "Your String ");

Eclipse - Limit logcat output to debug relevent logs

I reinstalled my Eclipse and now my Logcat logs everything my phone sends like battery status or mail sending status.
Is there a way to tell Eclipse/Logcat to just log what is really coming from my app which I'm debugging?
Filter the Logcat with "app:com.yourdomain.appname". I've also added a filter that gets rid of more items using a not operator:
tag:^((?!CoreMetrics|InputEventConsistency|memalloc|Adreno200-EGLSUB|Resources|global|TaggingRequest|Facade[B|U]|dalvik|skia|KeyCharacterMap|BackStackEntry|FragmentManager|ServiceRunnable|ServiceLocator|BaseHttpRequest|szipinf|APACHE).)*$
You'll need to edit the list specifically for the items you're seeing, but it's a great way to reduce the static.
You can log using a Tag and then filter in logcat using the same tag. You can add a filter by clicking on the + in the left hand side list. You can recognize it because the first tag will be "All Messages". Clicking through the list enables the filters.
Log.i("MyTag", "some log message");
Also in newer versions of the ADT eclipse plugin, I blieve that it auto-adds your app to the filter list.
In Your LogCat click button(Second Last) to left of the "downarrow button" the click "plus" sign write filter name and in application write the package name of the app you wanna get filtered logs for examole com.yourapp press ok and viola !!!
You can enter search filters in the search box at the top, or you can make those filters permanent via the filters panel visible on left side of eclipse logcat window. If it is not visible then note the button on the top right of logcat that displays/hides it.
"Is there a way to tell Eclipse/Logcat to just log what is really coming from my app which I'm debugging?"
Not exactly. You should be able to do that with the filter "app:com.yourapp". This filters based on the 'application' column/data of the logcat output, which would be perfect but Android devices are rather eratic at adding that information to debug output. Actually, the Nexus 4 is the first phone I've used that reliably specifies that data field in its logcat output.
But even if 'application' column doesn't work for you, you should be able to find other filters that reduce the visible log statements to a manageable level.

Categories

Resources