Logger log cleared automatically

后端 未结 1 1873
温柔的废话
温柔的废话 2021-01-29 13:14

I created this script to send logs by email, similar to the example on https://developers.google.com/apps-script/reference/base/logger# A \"Report problem\" menu item is availab

1条回答
  •  -上瘾入骨i
    2021-01-29 14:13

    The log is for debugging purposes. The idea is that once you run the function you are already in the script editor and you can just look at what went wrong.

    To get around this, you can have the script that you are logging use getLog() to retrieve it as string and output the string into a file on the users Google Drive. YOur "Report Problem" script then takes that file and sends it over.

    This is the way logs work in every programming language that I know. It is discarded and started from scratch when you start the program again unless you write it to a file. That is exactly what you have to do here as well.

    EDIT: you can also view historical logs here: https://console.cloud.google.com under StackDriver → Logging → Logs

    0 讨论(0)
提交回复
热议问题