| Line 1: |
Line 1: |
| − | The Logcat output is a device wide logging mechanism that logs key system events and errors. | + | <pre class="header-style">The Logcat Message trigger fires when specified content appears in the device's Logcat output. Logcat is a device-wide logging mechanism that records key system events, app messages, and errors. This trigger requires special permissions that must be granted via ADB on non-rooted devices.</pre> |
| | | | |
| − | This trigger will fire when the specified Logcat message content is seen within the device's Logcat output.
| + | ''' Options ''' |
| | | | |
| − | You can enable this feature
| + | * '''Component''': The component/tag name to filter log messages by. Use "*" to match all components. Supports wildcards and magic text. |
| | | | |
| − | to work on non-rooted devices using the adb tool from a connected PC. For full information check out this forum post here: | + | * '''Text to Match''': The text pattern to search for in log messages. Supports wildcards and magic text. |
| | | | |
| − | https://macrodroidforum.com /index.php?threads/adb-hack-granting-extra-capabilities-via-the-adb-tool.48/
| + | * '''Ignore Case''': When enabled, the text matching is case-insensitive. |
| | + | |
| | + | * '''Log Buffers''': Configure which log buffers to monitor (in MacroDroid Settings): |
| | + | ** Main - Main application logs |
| | + | ** System - System messages |
| | + | ** Crash - Crash reports |
| | + | ** Kernel - Kernel messages (if available) |
| | + | ** Radio - Radio/telephony logs |
| | + | ** Events - System event logs |
| | + | |
| | + | ''' Requirements ''' |
| | + | |
| | + | This trigger requires the READ_LOGS permission, which must be granted via one of the following methods: |
| | + | |
| | + | '''Method 1: ADB (Non-rooted devices)''' |
| | + | 1. Install the ADB tool on a computer |
| | + | 2. Enable USB Debugging on your device |
| | + | 3. Connect the device via USB |
| | + | 4. Run: <code>adb shell pm grant com.arlosoft.macrodroid android.permission.READ_LOGS</code> |
| | + | |
| | + | '''Method 2: Root''' |
| | + | On rooted devices, MacroDroid will attempt to grant the permission automatically. |
| | + | |
| | + | '''Android 14+ Additional Setup''' |
| | + | Additional configuration may be required on Android 14 and above. Consult the MacroDroid forum for specific instructions. |
| | + | |
| | + | ''' Examples ''' |
| | + | |
| | + | ''Example 1: Detect App Crash'' |
| | + | <pre class="trigger-style">Triggers |
| | + | |
| | + | Logcat Message - [*] FATAL EXCEPTION</pre> |
| | + | <pre class="action-style">Actions |
| | + | |
| | + | Popup Message - An app has crashed! |
| | + | Vibrate - 500ms</pre> |
| | + | |
| | + | Detects when any app crashes and shows a notification. |
| | + | |
| | + | ''Example 2: Monitor Specific App Messages'' |
| | + | <pre class="trigger-style">Triggers |
| | + | |
| | + | Logcat Message - [MyApp] Connection established</pre> |
| | + | <pre class="action-style">Actions |
| | + | |
| | + | Set Variable - app_connected = true</pre> |
| | + | |
| | + | Monitors for a specific log message from a particular app. |
| | + | |
| | + | ''' Magic Text ''' |
| | + | |
| | + | When this trigger fires, the following magic text values are available: |
| | + | * Full logcat line content - {logcat_line} |
| | + | |
| | + | ''' Notes ''' |
| | + | |
| | + | * The trigger clears the logcat buffer when it starts monitoring to prevent triggering on old messages. |
| | + | * Log messages are processed in real-time as they appear. |
| | + | * Wildcards (*) can be used in both component and text fields. |
| | + | |
| | + | ''' Performance Considerations ''' |
| | + | |
| | + | * Monitoring logcat can consume battery and processing resources. |
| | + | * Use specific component filters when possible to reduce processing overhead. |
| | + | * Consider the volume of log messages your filter might match. |