The print log is only displayed once or the print time is wrong in the Android scheduled task

Recently, the development encountered a pit, record it

I use timed tasks in Android, in order to detect whether the timed tasks are running normally, so I write like this


TimerTask is not used here, because I found that the Handler object already exists in the current class, so I used Handler directly. Of course, the effect is the same. Then, I first had a magical problem, which appeared for the first time in the log "- --------------------", I found that the next log was not printed after waiting for a long time, and then I changed the TimerTask to test, and the result was the same , after 2 consecutive days of continuous testing and analysis, it was finally found that the cause of the problem was caused by the cache of Logcat. The solution is


Append time to fix log cache issue

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325464743&siteId=291194637