37

I have the following test code in my Activity:

@Override
public void onStart() {
    super.onStart();
    Log.e(CLASS_NAME, "ERROR onStart()");
    Log.w(CLASS_NAME, "WARN onStart()");
    Log.i(CLASS_NAME, "INFO onStart()");
    Log.d(CLASS_NAME, "DEBUG onStart()");
    Log.v(CLASS_NAME, "VERBOSE onStart()");

On the logcat view in Android Studio, it only prints:

02-10 15:56:10.190    6194-6194/org.example.my_app E/MyActivity﹕ ERROR onStart()
02-10 15:56:10.190    6194-6194/org.example.my_app W/MyActivity﹕ WARN onStart()
02-10 15:56:10.190    6194-6194/org.example.my_app I/MyActivity﹕ INFO onStart()

On top of the box, the menu is set to Log level: “Verbose”, and if I go into the menu next to it, choose “Edit filter configuration”, “by Log Level” is also set to “Verbose”. Why are the Log.d() and Log.v() not printing anything? What might I am missing? Any suggestions would be appreciated.

aberna
  • 5,594
  • 2
  • 28
  • 33
Matthias Ronge
  • 9,403
  • 7
  • 47
  • 63

10 Answers10

26

Accepted answer not working

My solution:

when your Log.d is not working then Log.wtf is work

It's working for me, may be this is helpful to other, who find solution

Philip Kirkbride
  • 21,381
  • 38
  • 125
  • 225
Yogesh Rathi
  • 6,331
  • 4
  • 51
  • 81
  • 2
    Using `Log.wtf` is basically like using `Log.e`, only more severe. So this is not really an improvement over what the question already presents. The OP is trying to get logcat to show *less* severe log levels, D and V. – LarsH Jun 01 '17 at 21:16
  • 8
    what 'wtf' means ...? :D – KoreanXcodeWorker Aug 18 '17 at 09:00
  • 19
    WTF - means What a Terrible Failure. – Yogesh Rathi Aug 23 '17 at 10:08
  • Log.wtf has indeed appeared as error in logcat, but I mean WTF?! Developing android apps with Eclipse was pretty bad but Studio is just as pathetic. – soger Jan 29 '19 at 12:18
  • At first, I thought that this was a complete joke, but lo and behold the devs did add Log.wtf... Gotta love the coding community. This is now my second favorite right after isUserAGoat() – Pythogen Jul 23 '21 at 17:04
16

Android Studio filters lines that have already been logged but Log itself may filter some levels when logging. See Log.isLoggable:

The default level of any tag is set to INFO.

(However on many phone it is actually set to DEBUG or VERBOSE.)

StenSoft
  • 9,369
  • 25
  • 30
  • 1
    Thank you. The rest of the story: This can be changed on tag level on the shell until the next reboot, or by creating a config file. My phone doesn’t recognize the config file. [Here is a blog post](http://vnnotech.in/?p=198) that suggests logging everything to “info” with your own logger class which provides additional filtering. – Matthias Ronge Feb 11 '15 at 07:35
  • 1
    it could be device specific try http://stackoverflow.com/a/43999262/2783229 – Nitesh Tiwari May 16 '17 at 15:02
  • Take attention to filters dropdown in Logcat pane. – Manuel Lopera Feb 06 '18 at 03:23
13

Fix For meizu phone

Settings -> Accessibility -> Developer options -> advanced logging->set "Allow all"

For Meizu MX4(Flyme 6.1.0.0), M2(Flyme 6.1.0.0G), M5(Flyme 6.3.0.0G) :

Settings->Accessibility - > Developer Options -> Performance optimization -> Advanced logging -> set "Allow all"

Huawei, logcat not showing the log for my app?

For other phone search in "developers options": option "logging" and set "all".

GuyShoham
  • 29
  • 7
Fortran
  • 2,218
  • 2
  • 27
  • 33
10

Turn off your Developer Option then Restart Your Phone After that on developer option It definitely works by sure!!

Nicks
  • 3,188
  • 3
  • 25
  • 29
9

I've faced also to the same issue. Even following the previous answers, I didn't find the way to show logs in the Logcat.

After many tries done on my own, here is the (other) way to get logs shown:

Logcat screenshot

Just selecting "Show only selected application" in the combobox did the job. Priorly, it was "Firebase" which was selected.

Hopefully, you will see your logs ;-)

Serge Kishiko
  • 466
  • 1
  • 6
  • 13
8

I was trying everything. From log.d to log.wtf. But nothing worked.

Then I restarted my Android Studio. After that, the debugger started working again.

Hope this helps to someone.

Nabin
  • 11,216
  • 8
  • 63
  • 98
  • Restarting Studio did not help me. For some reason it does not want to show me verbose messages, but it shows errors. I remember a while ago it did work. Pathetic. – soger Jan 29 '19 at 12:21
3

For me the issue was that I had actually disabled the logger buffer in my developer settings so go to Settings -> Developer options -> Logger buffer size and set it to anything that isn't 'off'.

0x777C
  • 993
  • 7
  • 21
2

I had similar problem to this one. However in my case the problem was empty first string. It worked in older version of Android Studio, but stopped working in Android Studio ver 5.6 after update. When I used: Log.d(string1, string2); in my logging wrapper class, then whenever string1 was "", the logcat would ignore it. The solution was to add

if(string1 == null || string1 == "") {
    string1 = "defaultString";
}

before

Log.d(string1, string2);

I hope this helps anyone with this problem.

Apollo
  • 131
  • 1
  • 5
0

This started happening with me in Android Studio 3. I was getting old Log.v's printing, but when I added a new one nothing happened. Ditto with debugger breakpoints.

Cleaning the solution and restarting Android Studio worked for me, but there was a simpler solution.

Disable Instant Run. It seems that Instant Run doesn't recognise new Log.v's or breakpoints.

Along the way I also added Gradle-aware Make to my Run/Debug configuration for the main activity. I don't know whether that was necessary, but I'm keeping it. ([Main Menu] Run -> Edit Configurations...)

Add Gradle-aware Make to Project Run configuration

Stephen Hosking
  • 1,405
  • 16
  • 34
0

i had the same problem. I switched off and on developer options and usb debugging and all logs worked. i also enabled gpu debug layers in developer options(i dont think that helped).

dev
  • 1