KM Troubleshooting

Sorry, I've tried to search but there are so many topics on notifications and troubleshooting that trying to find a post about this isn't easy.

When a macro fails and notification pops up, clicking on it doesn't really do anything, and the notification itself isn't big enough to show the full text. I click it, nothing happens and it's gone. I can't find a log in KM to read what went wrong. What am I missing? How do I work out what happened in more detail?

Use Help > Show Logs Folder to open the logs folder. Within that logs folder, use any text editor to open Engine.log, and it will have a copy of the error message, showing the full text. For instance:

2024-04-22 21:30:00 Action 15442320 failed: Execute a Shell Script failed with script error: rm: /tmp/MUC_*: No such file or directory

`
-rob.

1 Like

Thanks Rob

The log is a great debugging tool—and you can make it even more helpful by using the Log action to add your own entries—mark when your macro enters and exits certain sections, record values of variables, etc.

When I'm working on something complicated, I use this simple macro quite often:

Download Macro(s): Tail the log.kmmacros (29 KB)

Macro screenshot

Macro notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.
System information
  • macOS 14.4.1
  • Keyboard Maestro v11.0.2

That runs the tail command on the log, which shows (in real time) entries as they get added to the log. I position the Terminal window so I can see it while the macro runs, and then can see what happens as it happens. When done, Control-C ends the tail command.

EDIT: Also, this thread is useful; it explains how to select the action related to an Action ID in the log that threw an error. I used it to write a very simple macro that asks for the action ID number, then uses the AppleScript line Peter showed to jump to that action.

-rob.

1 Like

Additionally, I've been having a lot of fun with this: MACRO: Engine.log Tool, v7.0 (Thanks @_jims !)

2 Likes

Glad you are enjoying it, @devoy.