MASTG-TECH-0009: Monitoring System Logs
On Android, you can easily inspect the log of system messages by using Logcat. There are two ways to execute Logcat:
- In Android Studio, if the app is running in debug mode, the log output will be shown in the Logcat window (accessible via View -> Tool Windows -> Logcat). You can filter the app's log output by defining patterns in Logcat.

- You can execute Logcat with adb to store the log output permanently:
adb logcat > logcat.log
With the following command, you can specifically grep for the log output of the app in scope, just insert the package name. Of course, your app needs to be running for ps to be able to get its PID.
adb logcat | grep "$(adb shell ps | grep <package-name> | awk '{print $2}')"
If you already know the app PID, you may give it directly using --pid flag.
You may also want to apply further filters or regular expressions (using logcat's regex flags -e <expr>, --regex=<expr> for example) if you expect certain strings or patterns to come up in the logs.
Tests¶
MASTG-TEST-0022: Testing Custom Certificate Stores and Certificate Pinning MASTG-TEST-0244: Missing Certificate Pinning in Network Traffic MASTG-TEST-0263: Logging of StrictMode Violations
Demos¶
MASTG-DEMO-0056: WebView Ignoring TLS Errors in onReceivedSslError MASTG-DEMO-0037: App Leaking Information about Unclosed SQL Cursor via StrictMode