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");
Related
I am a novice to the Android Studio and working on one group project.I am trying to log some variable values to logging.
When I use Log.e values are properly logged. While when I use Log.w or Log.v nothing gets printed. Here I am switching from logcat from error to verbose and to warning as I am using Log but still can't see anything printed.I previously used Toast but heard that using it might make my app slow and using Log.e everywhere is not a good practice.So how to print logs of lower priority?
I tried referring following resources but didn't find anything that could help me enabling logging for lower priority Logs, Just got the info that for some reason lower priority logs are disabled.
https://developer.android.com/reference/android/util/Log.html
Android Log.v(), Log.d(), Log.i(), Log.w(), Log.e() - When to use each one?
Thank you in advance.
All logs are always default enabled.
I think you are viewing logs in error view.
Check
You are viewing logs in Verbose
Your filter is set to selected app.
You have selected your app not other app. (where in below image no debuggable process is written)
Android Log.v(), Log.d(), Log.i(), Log.w(), Log.e() - When to use each one?
Log.e: This is for when bad stuff happens. Use this tag in places like inside a catch statement. You know that an error has occurred and therefore you're logging an error.
Log.w: Use this when you suspect something shady is going on. You may not be completely in full on error mode, but maybe you recovered from some unexpected behavior. Basically, use this to log stuff you didn't expect to happen but isn't necessarily an error. Kind of like a "hey, this happened, and it's weird, we should look into it."
Log.i: Use this to post useful information to the log. For example: that you have successfully connected to a server. Basically use it to report successes.
Log.d: Use this for debugging purposes. If you want to print out a bunch of messages so you can log the exact flow of your program, use this. If you want to keep a log of variable values, use this.
Log.v: Use this when you want to go absolutely nuts with your logging. If for some reason you've decided to log every little thing in a particular part of your app, use the Log.v tag.
Explanation by link Kurtis Nusbaum
Update:
If above things does not work then you are facing an device setting issue. Some mobiles have set default log level to DEBUG or ERROR. Allow logging from phone setting.
You can check if log is loggable by Log.isLoggable()
Check
Settings -> Accessibility -> Developer options -> advanced logging->set "Allow all"
or
Settings->Accessibility - > Developer Options -> Performance optimization -> Advanced logging -> set "Allow all"
or for other phone search in "developers options": option "logging" and set "all".
also you can use Log.wtf when your Log.d is not working.
try restarting android studio also
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 am using HTC One X.
There are some system application that has too many logs.
Because of that, I am able to see my application log only for some seconds. After some time, my logs are being remove from buffer since too many new logs from other application.
Can i disable log by using the tag.
Firstly, you cannot stop other applications from logging! Probably some apps more than others log too extensively causing an overflow. What you could try to do is
Force stop some apps so that thier logging activity is reduced(less chance it might reduce).
Secondly, as Rasel suggets,
Use DDMS features like filtering logs using application name, package name, TAG's etc. and pause logging.
In this way you will get a snapshot of your logs. Hope this helps!
I am facing this problem intermittently, the DDMS in Android does not show the name of any application as shown in the image below
This becomes such a major problem given the number of log messages it becomes impossible to see the relevant messages without setting the filter for a particular application.
My Question
What changes are required in the DDMS settings so that it always show the name of application in messages?
you can filter by tag, it is just a workaround, you should probably update your plugin, this happens sometimes when you have two ddms' but happens very rarely in my case, and usually I selected device wrong or something similar. I recall resetting ADB did the trick for me
In Android Manifest, set the application Debuggeable = True
works after that
My boss hopes that there is no information leak when users use our android apps.
And I found even I set the android:debuggable="false" it still can see my logs from Logcat or command line.
I searched android:debuggable someone also have the same problem.
I got some answers from internet, such as next:
There are a property called debugable of Avd. You can print by adb
shell get prop. I don't (know) if it is the cause of your problem.
If you have a pre-production device, you
can still debug an app that has debuggable set to false.
I just think, even I delete all my logs, there are also many logs about my app from OS.
My questions:
1.Is there a way I can do let my "android:debuggable" work well and
2.Is there any other way to hide all my logs except delete all my logs?
3.What does "android:debuggable" really mean?
4.What is "a pre-production device" when it goes on android device?
Thank you for your help. I will try some other ways, and try my best to share my information in here.
I simply create wrapper functions around Log that first check the value of a static boolean called loggineEnabled if it is set to true then log gets called otherwise the calls to log are ignored.
Then I simply set this variable to false before I compile a version of my app that I distribute.
void LogD(String msg){
if (loggingEnabled)
Log.d(MyTag, msg)
}
Is your code guaranteed to be bug-free? If not, why do you want to stop users having information that they might be able to use to shed light on bugs in your app?
Come back when you can write bug-free code, then we’ll talk.