Apple - How can I debug an Automator workflow?
Enable the Automator Log
Automator's Log panel should display more detailed error information. You can show it by clicking the Log item in the View menu (or pressing ⌥⌘L).
If you need to debug workflow outside of Automator.app, then syslog
command can be used.
Say you made Quick Action workflow with Run Shell Script action like below:
for f in "$@"
do
syslog -s -l i "Touching file: $f"
touch "$f"
done
Now you can use Quick Action in Finder:
Output of syslog
command can be viewed in Console.app:
Another way to view output of syslog
command – is to use log
command in Terminal.app.
log stream --info --debug --predicate 'process == "syslog"'
Update
We can improve Quick Action shown above by sending local notification on successful completion:
for f in "$@"
do
syslog -s -l i "Touching file: $f"
touch "$f" || exit 1 # Early exit on failure.
osascript -e "display notification \"Touched file: $f \" with title \"Automation\""
done