Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-9831

Clear logcat before snapshot


      Currently, the plugin will wait for the emulator to finish booting, unlock the screen, wait for it to settle a bit, and then take a snapshot.

      That means any subsequent reuse of that snapshot will contain the log buffer at the time the snapshot was taken, followed by a sudden change to the current log buffer. Example:

      05-25 23:21:45.774 D/MediaScannerService(  222): done scanning volume external
      05-25 23:22:30.574 E/ThrottleService(   72): Error reading data file
      05-25 23:22:31.804 D/AlarmManagerService(   72): Kernel timezone updated to 240 minutes west of GMT
      05-25 23:22:31.814 D/SystemClock(  139): Setting time of day to sec=1306923524
      06-01 06:18:44.092 W/SystemClock(  139): Unable to set rtc to 1306923524: Invalid argument
      06-01 06:18:44.272 D/AlarmManagerService(   72): Kernel timezone updated to 240 minutes west of GMT
      06-01 06:18:49.382 D/dalvikvm(  206): GC_EXPLICIT freed 1530 objects / 121432 bytes in 100ms
      06-01 06:19:00.162 D/dalvikvm(   72): GC_FOR_MALLOC freed 12506 objects / 741024 bytes in 162ms

      To prevent that, it would be useful to run the "adb -e logcat -c" command, which will clear the logcat buffer, immediately before taking the snapshot. You might even emit your own log message right after that, so that the top of every logcat archived will show the date/time from when the snapshot was created:

      $ adb -e logcat -c
      $ adb -e shell log -p v -t Jenkins "Creating snapshot..."

      It'll put this in the log:

      $ adb -e logcat -v time -d | tail -n1
      06-01 13:24:02.057 V/Jenkins (  517): Creating snapshot... 

      Then create the snapshot from there.

            orrc Christopher Orr
            jhansche Joe Hansche
            0 Vote for this issue
            0 Start watching this issue