tjanson / WifiLocationLogger

Android application for logging Wifi signal strength by location
32 stars 10 forks source link

Truncated log bug: Writing to log stops, while UI keeps updating #19

Open tjanson opened 9 years ago

tjanson commented 9 years ago

Okay, it seems I was wrong all along: I had suspected that either the Wifi scan code, or the background behaviour (wake-lock etc.) were the root of “incomplete” log bugs of any kind (#9 and #1), and I had been looking for bugs in that direction.

Adorfer and Frief had reported incomplete logs in the forums. There’s an important detail here, that I had so far overlooked: At least in Adorfer’s case, the app (UI) kept running and in fact updating with plausible values – in other words, the Wifi scanning was working fine! It was the logging itself that stopped.

The same bug was reported by @mmalte today. Note that the following are the final lines of the trace log, and that wifilog.csv stopped at the exact same time:

2015-03-17 17:02:09,084 [main] INFO  c.t.wifilocationlogger.MainActivity - Enabled logging to disk
2015-03-17 17:02:09,085 [main] INFO  c.t.wifilocationlogger.MainActivity - SessionID for remote logging: 614558ff-0ec2-4385-a69f-0be4cbaed762
2015-03-17 17:02:09,087 [main] DEBUG c.t.wifilocationlogger.MainActivity - Acquired wake-lock
2015-03-17 17:04:16,766 [main] DEBUG c.t.wifilocationlogger.MainActivity - onPause called, but logging to file; we'll keep going
2015-03-17 17:04:16,771 [main] TRACE c.t.wifilocationlogger.MainActivity - GoogleApiClient disconnected
2015-03-17 17:04:16,804 [main] TRACE c.t.wifilocationlogger.MainActivity - Unregistered WifiBroadcastReceiver

The last two lines match onDestroy being called.

My interpretation: For some reason the Activity was destroyed (without onStop!?) and recreated, with no noticable interruption. Wifi scans and GPS updates all kept going, the only thing that stopped (unfortunately) was the log.

tjanson commented 9 years ago

Bug is apparently triggered by display rotation.