Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Android TimingLogger is not able to print logs?

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.

like image 369
ASHOK KUMAR Avatar asked Aug 11 '16 11:08

ASHOK KUMAR


2 Answers

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 !!!

like image 89
ASHOK KUMAR Avatar answered Oct 16 '22 00:10

ASHOK KUMAR


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()

like image 42
Milan Avatar answered Oct 16 '22 02:10

Milan