Huawei, logcat not showing the log for my app?

86,204

Solution 1

OK, since I had another Huawei Ascend I ran into the same problem. This time I have the exact answer. Follow these instructions (from denispyr's answer on Why doesn't logcat show anything in my Android?)

Dial

*#*#2846579#*#*

and you will see a hidden menu. Go to the Project Menu > Background Setting > Log setting and define the log availability (log switch) and level (log level setting).

And then make sure you restart your phone.

Please note this probably only applies to Huawei phones.

Also note that if you're on a Huawei tablet (e.g. MediaPad M3), instead of dialing, you launch the Huawei Calculator in landscape and enter ()()2846579()().

Solution 2

For Huawei with Android 8.0+

we must dial the code: *#*#2846579#*#*

and selecting the option AP Log will be enough to display the messages in the LogCat.

introducir la descripción de la imagen aquí

Solution 3

If any one having Letv Phone (LeEco Le Max 2 or 1) above solution won't work. Try the below USSD. Fig.1 for reference.

Press Dialer *#*#76937#*#*

Select "Enable All Logs"

Fig.1

Solution 4

I gave up.

Log.d(TAG, msg);

Try this.

Log.wtf(TAG, msg);

work for me.

Solution 5

I have a HUAWEI Y3 II aka LUA-L21.

The accepted answer didn't work for me. It led to some MTKLogger settings screen, which is different than described in the answer, and didn't help at all.

My solution

  1. Dial *#*#2846580#*#* (please note this code is different from the one in the accepted answer)
  2. You just entered a settings screen called EngineerMode (again, different from accepted answer's ProjectMenu)
  3. In the first Telephony tab, click the Log Control item
  4. Activate both switches (set Mtklog control to catch all log and adb radio log to catch radio log by adb)
  5. Back in the previous screen, swipe to the Log and Debugging tab
  6. Open Debug Utils
  7. Change Debug Level from User Mode to Engineer Mode
  8. For good measure, restart your phone

Screens

Changing Log control

enter image description here enter image description here

Changing Debug utils

enter image description here enter image description here

Additional notes

Just to clarify my original problem; logcat was showing some of my app's log entries, just not my own messages - I saw entries belonging to my process com.example.myapp, but never anything I was printing out myself, in my code, using Log.d("TAG", "hello world");

There was plenty of stuff like this:

4260-4270/com.example.myapp I/art: Debugger is no longer active
4260-4412/com.example.myapp I/System.out: [CDS]rx timeout:1
4260-4412/com.example.myapp D/NativeCrypto: doing handshake ++
4260-4603/com.example.myapp D/OpenGLRenderer: Flushing caches (mode 0)
4260-4603/com.example.myapp D/Surface:  Surface::disconnect(this=0xb85285d8,api=1)
4260-4260/com.example.myapp D/ActivityThread: ACT-STOP_ACTIVITY_HIDE handled : 0 / android.os.BinderProxy@2333cbdf

...but never anything like this:

4260-4603/com.example.myapp D/MainActivity: hello from onCreate!

The above steps solved the issue for me.

Share:
86,204

Related videos on Youtube

William
Author by

William

I'm been coding commercially since 1992 and working almost solely with Java since 1999. Started Android development in 2009 and have developed several commercial apps, the biggest hit being Lexathon with 600k downloads. Was a Google Developer expert from 2012 - 2017 until my startup took off. Am now founder and CEO of Wylas Timing which has developed an automated timing system for swimming and athletics that is 100% wireless.

Updated on July 08, 2022

Comments

  • William
    William almost 2 years

    OK, logcat is showing system logs but it is not showing application log on my Huawei Ascend. If I switch to another device such as my Galaxy Nexus or Nexus 7 then for the same app (same APK even) log is displayed.

    The Huawei Ascend is running Android 4.1.1, it has USB debugging switched on in developer options. This occurs for logcat run from either the command line or from IntelliJ. And I'm making sure that the correct device is selected - in fact I'm only plugging a single device in at a time. I've tried restarting adb, clearing it's buffer etc

    I can see that the app is starting on the Huawei, I even get system logs showing that the Activity has started. But unlike on the other devices I get no app log in the Activity#onCreate (or from anywhere else).

    08-08 20:55:44.050: INFO/WindowManager(431): Switching to real app window: Window{41ae8780 au.com.xandar.wirelesstiming.timekeeper/au.com.xandar.wirelesstiming.timekeeper.TimeKeeperActivity paused=false}
    08-08 20:55:44.180: INFO/ActivityManager(431): Displayed au.com.xandar.wirelesstiming.timekeeper/.TimeKeeperActivity: +387ms
    

    How can the application log not be getting delivered?

    • g00dy
      g00dy almost 11 years
      Maybe you've applied a certain filter in the LogCat output - go check it out.
    • Admin
      Admin over 7 years
    • William
      William over 7 years
      @CamilStaps because this problem is specific to Huawei phones.
    • Admin
      Admin over 7 years
      That doesn't really matter, the point is that it has been answered elsewhere already.
    • William
      William over 7 years
      @CamilStaps This question has not been answered elsewhere. Hene the number of people that it has helped compared to the other.
    • Admin
      Admin over 7 years
      Yes, it has: your own answer points to stackoverflow.com/a/10963065/1544337 which answers your question.
    • William
      William over 7 years
      @CamilStaps Read the 2 questions. This question has not been asked elsewhere.
    • Fortran
      Fortran over 6 years
    • surhidamatya
      surhidamatya over 6 years
      this solution did worked for me stackoverflow.com/questions/42691076/…
  • William
    William almost 11 years
    As I said above, I'm using logcat from either command line or IntelliJ. I don't use Eclipse. And second, as I also said above I have already tried resetting adb (multiple times).
  • g00dy
    g00dy almost 11 years
    This does not work on 4.x.x and above for system logs, only for the concrete application logs with READ_LOGS permission set - code.google.com/p/alogcat/issues/detail?id=41.
  • charlesfranciscodev
    charlesfranciscodev almost 7 years
    This does not work on the Huawei ECO phone. Any tips? Model #: LUA-L23
  • Nitesh Tiwari
    Nitesh Tiwari almost 7 years
    @charlesfranciscodev have you tried #*#2846579#*#. As mentioned in above answer
  • charlesfranciscodev
    charlesfranciscodev almost 7 years
    Thanks this worked for me on the Huawei ECO phone!
  • William
    William almost 7 years
    Log.wtf() is designed to a totally unexpected state. It is akin to SEVERE. It is certainly not DEBUG
  • Aleksey_M
    Aleksey_M almost 7 years
    Thanks. Working with LeECO x527
  • Fortran
    Fortran over 6 years
    Xd i think Log.e()/Log.w()/Log.i() work very nice too.
  • Dmytro  Turkov
    Dmytro Turkov almost 5 years
    For Huawei CRO-L22 and some other Huawei with MTK works code for engineer mode #*#14789632#*#
  • Talu
    Talu about 3 years
    Thanks! #*#14789632#*# works on Y5 Lite (CRO-L03)