Logging Options for Android

The GPSD process supports the following logging options:

  • File
  • Logcat
  • Java (*Recommended*)

## File:

The log to file option logs all the gl loglines to a file through the RIL interface

  • Change the setting in the xml file (inside the hal section): ~~~~ .xml Log="FILE"  ~~~~
  • _pros:_ + simple logging + It is useful while checking bring-up issues.
  • _cons:_ + no logcat data is available. + GPS daemon can be stalled if I/O operations take time to write, close, or open files + Logging to SD card is not possible in Jellybean and beyond, due to security restrictions imposed by Android{tip}

## Logcat:

This is a regular logging option where all the slog is sent to logcat

  • Change the setting in the xml file (inside the hal section): ~~~~ .xml Log="LOGCAT"  ~~~~
  • _pros:_ both the slog and logcat information is in one place inside the logcat
  • _cons:_ Long runs will loose information.  Logcat uses circular storage buffer and will delete earliest information when the buffer is full.

## Java:

This is a Java logger. An Application (BrcmGpsLogRecorder.apk), that comes in theSDK package needs to be installed. Logging can include slog, logcat or both. Below are the steps to follow to install and run the apk:

  • Install the apk ~~~~ .xml $ adb install BrcmGpsLogRecorder.apk ~~~~
  • Start the service with the below command. This is needed only the first time you install the apk: ~~~~ .xml $ adb shell am startservice -a com.broadcom.test.gpslogrecorder.START_SERVICE ~~~~
  • Give permission for the apk (only for Android 4.2 & later). ~~~~ .xml $ adb shell pm grant com.broadcom.test.gpslogrecorder  android.permission.READ_LOGS ~~~~
  • Change the setting in the xml file (inside the hal section): ~~~~ .xml Log="JAVA"  ~~~~
  • _pros:_ + both the slog and logcat information is in one place inside the logcat
  • _cons:_ + Logging to internal filesystem is not possible in Jellybean and beyond, due to security restrictions imposed by Android + Java logging apk must be installed and running to collect logs.

## Log Directory Max Size Option

User can set Logging directory size limit in MB with the following xml config param "LogDirectoryMaxSizeMb".
Set to 0 to indicate "no limit". Once directory reaches limit, older logfiles may be deleted to free up space.
If the current logfile is the only one, an error message is written to logfile and no further logs will be written.

~~~~ .xml LogDirectoryMaxSizeMb="0" // Specify the max size of log directory in MB; 0 indicates no limits. ~~~~

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines