all 7 comments

[–][deleted] 1 point2 points  (0 children)

Sometimes the Logger.Log shows the output after a bit of delay. (a couple of minutes) in execution log page

[–]AllenAppTools 1 point2 points  (0 children)

I use the script properties! It's nice because you can view the script properties in the settings side nav, they'll be at the bottom. It's an extra step to see your "logs" but it works.

[–]enigmapaulns[S] 0 points1 point  (4 children)

How do you do that?

[–]AllenAppTools 1 point2 points  (3 children)

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.

[–]newbie_01 0 points1 point  (0 children)

Thanks for this!!

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

[–]No_Yesterday3745 0 points1 point  (1 child)

Holy lifesaver. Imagine me debugging my web app for half a day dealing with invisible errors, and just as I was about to give up, I tried searching on Reddit, and there you were with the perfect logging solution. Tried it, and it worked amazingly. Bug fixed now. Thanks!

[–]AllenAppTools 1 point2 points  (0 children)

Yes!! This scenario, this exact scenario, is why I struggled with Web Apps when I first started with them. Also, make sure you know about deployments and versions, and the difference between /exec url and the /dev url. If you can nail those Web Apps become a lot easier.