You can log into the console window if you add set echo on to the beginning of startup-sequence and you can prevent the console window from closing if you remove the endcli command from the end. Or insert ask "press enter" before endcli.
The latter alone will already allow you to read error messages. Both in combination will also show you which command output the message. To stop the log flow you can press any key and continue by deleting the key you entered.