Skip to content

Gathering app logs

damontecres edited this page Oct 22, 2024 · 3 revisions

The easiest way to gather logs is to use the StashAppAndroidTV Companion plugin. This plugin can be installed on the Stash server.

Quick steps

  1. Install the plugin on your server by either:
    1. In app settings, click "Install companion plugin" to trigger the install on your server
    2. Or in server settings, go to Plugins and search for "StashAppAndroidTV Companion" in the default Community source
  2. Open the Android TV app
  3. Perform the steps that cause the issue
  4. If the app crashes, send the crash report to your server
  5. Check your server's Web UI Settings->Log tab for the logs

Including the logs in a bug report is a great way to help developers diagnose and fix issues.

Always review the logs before sharing them publicly to ensure they do not contain any personal information!

Requirements

Privacy

Privacy is very important! The app will never send logs without your consent. If you choose to do so, the logs are only sent to your Stash server.

The logs usually do not contain any personal information, but they will contain information such as:

  • The device model, manufacturer & Android version
  • The app version
  • The app's settings excluding API keys
  • The date and time including your time zone
  • Possibly the URL of your Stash server

Always review the logs before sharing them publicly to ensure they do not contain any personal information!

Detailed instructions

The app logs can be sent to your Stash server in two ways: via a crash report or manually.

App crash report

If the app crashes, a dialog will be shown allowing the user to send the crash report to the currently configured Stash server. You can view the crash report in the Stash server's Settings Log tab.

It will be a single line error level entry of JSON similar to this (formatted for readability):

{
  "STACK_TRACE": "java.lang.IllegalStateException\n\tat com.github.damontecres.stashapp.SettingsFragment$PreferencesFragment ....",
  "LOGCAT": "07-31 16:16:39.770 E\/AndroidRuntime( 2464): \tat androidx.core.app.ComponentActivity.superDispatchKeyEvent ....",
  "CUSTOM_DATA": {
    "SDK_INT": "34"
  },
  "APP_VERSION_NAME": "0.3.2-3-g69c425b",
  "IS_SILENT": false,
  "APP_VERSION_CODE": 37,
  "REPORT_ID": "c5099a64-de7e-4a25-a0f5-d7e573c131a8",
  "PHONE_MODEL": "sdk_google_atv64_arm64",
  "ANDROID_VERSION": "14",
  "BRAND": "google",
  "PRODUCT": "sdk_google_atv64_arm64",
  "USER_CRASH_DATE": "2024-07-31T19:16:39.805-04:00",
  "SHARED_PREFERENCES": {
    "default": {
      "skipWithDpad": true,
      "autoCheckForUpdates": true,
      "stream_choice": "HLS",
      "VERSION_CURRENT_KEY": "0.3.2-3-g69c425b",
      "VERSION_CODE_PREVIOUS_NAME": 37,
      "playback.showDebugInfo": true,
      "skip_forward_time": 60,
      "playback.experimentalFeatures": true,
      "updateCheckUrl": "https:\/\/api.github.com\/repos\/damontecres\/StashAppAndroidTV\/releases\/latest",
      "networkCacheLogging": false,
      "interface.showGridFooter": true,
      "networkCacheDuration": 3,
      "pinCodeAuto": true,
      "VERSION_CODE_CURRENT_KEY": 37,
      "VERSION_NAME_PREVIOUS_NAME": "0.3.2-1-g1c4f4f5"
    }
  },
  "USER_COMMENT": "",
  "USER_EMAIL": ""
}

You can disable the crash reporting feature in the app's advanced settings if you do not want to be prompted to send crash reports.

Manual log collection

The app logs can be sent to your Stash server manually by following these steps:

  1. Open the app
  2. Perform the steps that cause the issue
  3. Open the app's settings
  4. Select Send logs near the bottom of the settings

Then on your server's Web UI, you can view the logs in the Settings Log tab. It will be a single line info level entry that looks similar to:

[Plugin / StashAppAndroidTV Companion] ** LOGCAT START **<newline>--------- beginning of main<newline>07-31 16:26:31.854  3002  3074 V StashClient: Creating new OkHttpClient for Glide<newline>07-31 16:26:31.854  3002  3074 V StashClient: User-Agent=StashAppAndroidTV/0.3.2-3-g69c425b (release/14; sdk/34) (Google; sdk_google_atv64_arm64; emu64a)<newline>07-31 16:26:31.953  3002  3002 D StashApplication: onActivityStopped: com.github.damontecres.stashapp.PinActivity@4b46ab4<newline>07-31 16:26:31.954  3002  3002 V StashApplication: onActivityDestroyed: com.github.damontecres.stashapp.PinActivity@4b46ab4<newline>07-31 16:26:35.897  3002  3002 D StashApplication: onActivityPaused: com.github.damontecres.stashapp.MainActivity@1b9b10a<newline>07-31 16:26:35.950  3002  3002 V SettingsFragment: refresh<newline>07-31 16:26:35.951  3002  3031 V QueryEngine: executeQuery 11 Configuration<newline>07-31 16:26:35.965  3002  3031 V QueryEngine: executeQuery 11 Configuration successful<newline>07-31 16:26:35.976  3002  3023 E OpenGLRenderer: Unable to match the desired swap behavior.<newline>07-31 16:26:35.978  3002  3002 E tecres.stashapp: Invalid resource ID 0x00000000.<newline>07-31 16:26:36.479  3002  3002 D StashApplication: onActivityStopped: com.github.damontecres.stashapp.MainActivity@1b9b10a<newline><newline>** LOGCAT END **

You can replace <newline> with actual new lines to make it more readable.

Verbose

You can get much more verbose logs by long clicking the Send logs button. This has a lot more information potentially including data about other apps on the device, so please review before sharing publicly!

Advanced

Debug logs in app

You can open the debug view by clicking on the app version 3-4 times on the settings page. This will display a page with:

  1. All of the app settings (which may include truncated API keys)
  2. All of the server-side settings imported from the current server
  3. Some additional debug information about URLs
  4. Logcat logs from the app

Cache logging

Cache hits/misses can be logged by enabling the setting under Settings->Advanced->Cache->"Cache Logging". You should kill and restart the app for this setting to take effect.

Use adb/logcat

If you are comfortable with the command line, you can use ADB and logcat to gather logs from the device directly. There are more options for searching and filtering this way.

The app uses a lot of tags, but this is a good starting point:

adb logcat -s StashClient:V QueryEngine:V MutationEngine:V MainFragment:V FilterParser:V MainPageParser:V '*:E'