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 available to the users. However, seems like everytime a menu item is executed the log is cleared. Is there a way around this? If not, what is the purpose of having a logging system if it is cleared everytime a function is ran?
相关问题
- How can I force all files in a folder to be owned
- Google Apps Script: testing doPost() with cURL
- Google Apps Script to turn in, grade, and return a
- I want to trace logs using a Macro multi parameter
- Error message 'No handlers could be found for
相关文章
- how do I log requests and responses for debugging
- Android Studio doesn't display logs by package
- How to allow access for importrange function via a
- Google app script trigger not working
- Stacktrace does not print in Glassfish 4.1 Cluster
- Set Date/Time to 00:00:00
- Out of curiosity — why don't logging APIs impl
- Laravel log file based on date
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