When I connect my galaxy s3 mini via ADB and try debug application with android studio I get endless error/warning messages in logcat, non-stop messages goes like crazy. Is that normal? Usually with emulator I don't get tons of message in logcat. How can I fix this problem? here's how logcat looks like http://pastebin.com/JaVhYaCt or http://i.imgur.com/aaavMZm.png?1
By the way: I still able to test applications.
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.
Example...
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.
Simplest answer is that is normal to see all this verbose logging (the logcat contains info from everything on the phone, so can get quite verbose).
You can filter what is shown in logcat by using filters. If using the command line, it might look something like this (don't forget the end S:* - which indicates to 'Silence' everything. A simple tag filter from command line might look like this (show only messages with tags SHOWTAG1, and SHOWTAG2:
adb logcat SHOWTAG1:* SHOWTAG2:* S:*
The eclipse tooling (and maybe Android Studio, not sure) also has a Logcat viewer, which allows you to apply tags to filter by, or otherwise, use Regex or other filtering mechanisms to modify what is shown.
Bottom line, Logcat is verbose, you will need to filter it specifically to see what you want.
Related
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!
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");
I am currently using ACRA for capturing errors and improving my application. I would like to filter in Logcat all logs generated due to my application running which includes not only those that my app generates, but also those that are generated by libraries used by app (like GooglePlay).
Usually what I have seen suggested is filtering by TAG, but that will not allow me to see logs that I have not tagged (like, for instance, ACRA... )
There is a solution in eclipse where I can filter both using TAGs but also by Application name and/or its process ID. That's what I would like to do, filter by my application name the logcat output sent to ACRA.
I would like to use a command in logcat to reproduce the following option I select in eclipse:
Finally the question is at logcat level. Is possible to filter logcat at adb level using a filter by application and not by TAG
Is the only option to have a single TAG for all the application Logs? Another way around I have is to filter "all TAG starting by xxxx", but I have not found any example in google, not using "*".
Any solution using Linux shell (like grep) is not workable, I already tested it as the way the information is passed by ACRA.
Trebia,
The tricky part of your request is "adb logcat" spits out PID. The only way I know of to filter by application name is to write a script to query the OS via "ps" to look up the PID. I am not aware of any way to do that within eclipse with out editing the logcat plugin yourself.
If you are using a Mac and you are willing to do the filter outside of eclipse you should try LogRabbit. It can filter by application name or just about any thing else you would need to filter by. In addition to a rich filter creator your saved filters are just one click away for real-time filtering.
You can find more information here: http://lograbbit.com/
Full disclosure I am the creator of LogRabbit.
When testing on a device in Android Studio you get an awful lot of output in the logcat.
I'm only interested in the output for the app I'm developing. I can see just this, after running, by opening the Devices section and manually selecting my apps process. Problem is, it's pretty tedious to do this every time I run my app, which seems to be the case.
Is there a way to get it to remember this setup?
How about a way to get it to stop reporting anything after I'm done with my app or it's crashed ? (otherwise my app specific stuff gets buried so quickly by output from other proccesses on my phone)
I'm open to other ways of filtering the logcat too, however I couldn't think of a way to set up filters so that I would get my tagged Log messages AND other exceptions I wasn't expecting.
Any suggestions?
Normally this is done by default, but if not,
in logcat, the green plus sign, when you click it you get a dialog, fill the byApplicationName with your package name, and also your filter name with something, now you can filter your output according to your app
with that beeing said, sometimes you don't get the filter column info (application name) in logcat at all (blank), here (and I my self don't know the cause of it) just forget it for a while and retry again
I know this question has been asked a lot, but none of the solutions proposed worked for me
Since I started my project, my LogCat has been displaying just enough information about my app. But somehow (I don't remember changing any settings), it is now displaying too many information. And It makes it impossible to detect my Log messages.
The problem is I don't use My appName as TAG for most of these Logs. I used my methods names to detect my messages. Wish makes the following solution not appropriate in my case : adb logcat -s "MyAppName"
I tried the filters proposed by eclipse, but none of them makes it look like it used to be !
Do you guys happen to know any other solution ??
this is quite easy : in the logcat view click the side menu button : it makes filters appear on the left.
you can add filters by cliking the '+' sign and add yout application package identifier as filter.
set the name you want for your filter :
you can also filter by log levels, tags etc...