How do I “Use Logger API to add logs to your proje

2019-01-27 22:08发布

问题:

I'm trying to see output of a script, but when I go to "View Logs" I get an alert "No logs found. Use Logger API to add logs to your project."

How do I add the Logger API?

回答1:

You will want to add into your code

Logger.log("Yes, this was logged");

Also reference this page for more info: https://developers.google.com/apps-script/reference/base/logger



回答2:

Quote:

You need to have access to the Apps Script's Cloud Platform project in order to view the logs the script creates.

Apps Script Documentation - Logging Requirements

You can not just add:

console.log();

To your script and have it work.

From the "View" menu, choose "Console logs"

You will be prompted to Enable Console Logging.