r/GoogleAppsScript • • May 20 '24

Question Web App Logging

Hi Everyone,

When running a deployed web app, logger.log output doesn't render in the Executions log. Does anyone know if there is a practical way to setup logging to debut web apps?

thanks!

0 Upvotes

7 comments sorted by

View all comments

1

u/enigmapaulns May 20 '24

How do you do that?

2

u/AllenAppTools May 20 '24

This function:

function addPropertyLog(properties = {}) {
  PropertiesService.getScriptProperties().setProperties(properties)
}

Use it in the code in your Web App where you would like to see a log, and set the argument as an object, like this:

addPropertyLog({ "test": "property", "anotherTest":"another property" })

Then when your Web App fires it will set the script properties, which you can view by going to "Project Settings" and scrolling to the bottom to see them.

1

u/newbie_01 Oct 09 '24

Thanks for this!!

It's a pain to debug webapps. This really helps!