| Line 1: |
Line 1: |
| − | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;"> | + | <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> |
| − | The Logcat output is a device wide logging mechanism that logs key system events and errors. | |
| | | | |
| − | This trigger will fire when the specified Logcat message content is seen within the device's Logcat output.
| + | ''' Options ''' |
| | | | |
| − | You can enable this feature to work on non-rooted devices using the adb tool from a connected PC. For full information check out this forum post here:
| + | * '''Component''': The component/tag name to filter log messages by. Use "*" to match all components. Supports wildcards and magic text. |
| − | </pre>
| + | |
| − | * ''How to grant permissions '' ''[https://macrodroidforum.com/index.php?threads/adb-hack-granting-extra-capabilities-via-the-adb-tool.48/ ADB Hack]'' | + | * '''Text to Match''': The text pattern to search for in log messages. Supports wildcards and magic text. |
| − | * ''If you do not have MacroDroid Helper installed, download it from here.'' ''[https://www.macrodroidforum.com/index.php?threads/macrodroid-helper-apk.1/ Installing helper.]''
| + | |
| − | * ''If you have Android 14, additional configuration is required.'' ''[http://www.macrodroidforum.com/index.php?threads/installing-helper-on-android-14.5606/ Installing helper on Android 14+.]''
| + | * '''Ignore Case''': When enabled, the text matching is case-insensitive. |
| − | * ''When this trigger is present, you can use more [...]'' ''[https://macrodroidforum.com/wiki/index.php/Magic_text#Logcat magic text]''
| + | |
| | + | * '''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. |
| | + | * The trigger uses a coroutine-based approach for efficient background processing. |
| | + | * On rooted devices, the trigger can access logcat output with elevated privileges. |
| | + | * Diagnostic mode can be enabled in the code for troubleshooting (logs every 100 lines processed). |
| | + | |
| | + | ''' 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. |
| | + | |
| | + | ''' See Also ''' |
| | + | |
| | + | * [[ADB_Hack|ADB Hack Guide]] |
| | + | * [[MacroDroid_Helper|MacroDroid Helper]] |