Enable DEBUG & VERBOSE for Huawei Android Logcat

I'm having Huawei Nova Plus I found that Huawei only prints to its Android log starting log level INFO. As per Huawei; this is done for performance optimization purposes.

Any Android developer requires logging level DEBUG & VERBOSE.

This post mainly states the trials I have done trying to solve this issue till reached a solution / workaround.

For the record my device information was:
Model number: HUAWEI MLA-L11
Build number: MLA-L11C185B131  &  MLA-L11C185B151
EMUI version: EMUI 4.1
Android version: 6.0

I found same issue in other Huawei models like GT3, Mate 8.

1- Huawei secret menu (Source link with screenshots in xda developers):
Type *#*#2846579#*#* in dialer application, when "ProjectMenu" appears -> 1.Background Settings -> 3. LOG Settings -> mark the check of "AP Log". Reboot your mobile.
Repeat above steps to access secret menu, and check the "AP Log" if you found it is still checked after reboot, your phone is ready :) otherwise try next method.
Note: It didn't work for me, maybe of a bug on Huawei.
Update: 9-Dec-2017
After several upgrades till reached:
Model number: HUAWEI MLA-L11
Build number: MLA-L11C185B341
EMUI version: EMUI 5.0.1
Android version: 7.0
The logging started working in Android Studio Logcat for all libraries as desired, but unfortunately the settings works till restart mobile, i.e. once device restarts you need to enable log checks from same menu to continue debugging.

2- Set log level for some application tags:

a- Open adb shell while your device is connected, usually located in ANDROID_SDK\platform-tools
adb shell

b- Set log level to verbose for specific tags (change below MYTAG to whatever important tag in your application)
C:\android\sdk\platform-tools>adb shell
shell@HWMLA:/ $ stop
shell@HWMLA:/ $ setprop log.tag.MYTAG VERBOSE
shell@HWMLA:/ $ start
shell@HWMLA:/ $


c- Test your application, and check logs, if it works make the above as script and set all your important tags to be VERBOSE. Downside of this script, is the need to apply it every-time your restart your phone.
Note: It didn't work for me, I don't know why.

3- Workaround using external logging framework (Timber):
a- I switched my code to use Timber (It was pretty easy refactor).

b- I made small customization to Timber.DebugTree & created a class HuaweiTree in my project. It simply switches log level of VERBOSE & DEBUG to INFO so Huawei will print it. The code is below:
package ...;

import android.util.Log;
import timber.log.Timber;


public class HuaweiTree extends Timber.DebugTree {
    @Override
    protected void log(int priority, String tag, String message, Throwable t) {
        if (priority == Log.VERBOSE || priority == Log.DEBUG)
            priority = Log.INFO;
        super.log(priority, tag, message, t);
    }
}


c- Plug this customization to your code, by adding it to your application class onCreate method
    @Override
    public void onCreate() {
        super.onCreate();
       
        // ... As early as possible ...

        if (BuildConfig.DEBUG) {
            String deviceManufacturer = android.os.Build.MANUFACTURER;
            if (deviceManufacturer.toLowerCase().contains("huawei")) {
                Timber.plant(new HuaweiTree());
            } else {
                Timber.plant(new Timber.DebugTree());
            }
        }
        // ... Continue your application ...
    }




I hope in future if I find better solution; I will try to keep this post updated.

Update: 9-Dec-2017
 After using Huawei nova plus mobile for over a year now, I really like the phone and build quality, so as a normal user I recommend. But, as a developer, I don't recommend Huawei phones for Android development due to two main reasons:
1- Support will not answer you, I have tried every link, email, facebook page.
2- I recommend a phone with stock Android experience.