Why Android TimingLogger is not able to print logs?

不想你离开。 提交于 2020-01-01 08:04:16

问题


I am trying to use TimingLogger for checking time consumed for a particular method and its statements. But Android TimingLogger is not able to print logs.


回答1:


If the Log.isLoggable is not enabled to at least the Log.VERBOSE level for that tag at creation time then the addSplit and dumpToLog call will do nothing.

If you simply looking for logs as explained in https://developer.android.com, you will not be able to see logs. So use below command in adb:

adb shell setprop log.tag.MyTag VERBOSE

Note: MyTag is the first parameter you passed when creating new TimingLogger as below:

TimingLogger timings = new TimingLogger("MyTag", "MyMethodName");

And there you are. Happy coding !!!




回答2:


Apart from changing the log level, I also had to reset the TimeLogger to set it's mDisabled flag. You can do so by timingLogger.reset()



来源:https://stackoverflow.com/questions/38894533/why-android-timinglogger-is-not-able-to-print-logs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!