I've not touched my Google Marketplace Add-on in several years, and it recently started failing. I've narrowed down the line number from the Logs explorer at https://console.cloud.google.com/logs/ - those seem to only be error events, containing the error message and the source line. Useful, but I need more info.
I added some Logger.log
statements to get more info (as far as I understand, it's not easy/possible to get breakpoints to trigger when you run code from an add-on). But I can't figure out (remember) where those logs are now (it used to be in the Apps Script view). I'm running the Logger.log
version of the code via Deploy > Test deployments in the Apps Script project (script.google.com).
I looked at Executions (left side menu) but my Add-on has 100k+ users and I can't see "my" Test Deployment execution easily. I found the "Filter" and I can check for "Ran As: Me" and I see my failed execution, but it's just an error (the Logger message trace isn't there).
Apps Script has an Execution log button, but as far as I can tell it's only showing the execution of selected functions inside the Apps Script.
How can I see the Logger.log
messages in a Test Deployment of an Add-on?
ETA:
Logger.log
messages there.Logging has evolved, and Logger.log
basically only works for debugging functions in the Apps Script environment. Since my add-on is deployed in the cloud, Cloud Logging must be used.
I was finally able to get output by using console.log
with a JSON format:
console.log({message: 'inside function blah', someInfo: 15});
This message
output appears in the Executions list. If you want to see the other JSON info, it's visible if you view it in VIEW IN CLOUD LOGGING (button on the right).
It is also possible to just do console.log("hello");
without using JSON.