Search code examples
androidkotlinanko

Anko Logging with verbose and debug isn't working


I'm trying to use Anko Commons – Logging

but for some reason the verbose and debug not showing on the logcat

however, when I use Log.d it works as expected.

when I'm trying this code

verbose("-------------verbose--------------")
debug("-------------debug--------------")
info("-------------info--------------")
warn("-------------warn--------------")
error("-------------error--------------")
wtf("-------------wtf--------------")

the log logcat is as following enter image description here

I'm using Anko 0.10.0 android studio 3.0 canary-5

when I tried to search for a solution I found this one

All Log.* will log to logcat regardless of what the current log level is. However, AnkoLogger.* will only log to logcat when its log level is loggable.

but I don't know how to change the log level, and if even it's my problem is the same.


Solution

  • It turns out The default log level is INFO.

    From the ADB shell, you can change the log level to DEBUG, VERBOSE etc. using this command:

    setprop  log.tag.MyApp  DEBUG
    

    so As far as know by AnkoLogger uses Log.isLoggable() under the hood which ignores VERBOSE and DEBUG log levels by default.

    for more info you can read more about it here