我如何"使用Logger API将日志添加到项目中#34;? (谷歌脚本)

时间:2017-06-30 12:45:52

标签: google-apps-script

我试图查看脚本的输出,但是当我转到"查看日志"我收到警报"没有找到日志。使用Logger API将日志添加到项目中。"

如何添加Logger API?

enter image description here

2 个答案:

答案 0 :(得分:2)

引用:

  

您需要访问Apps脚本的Cloud Platform项目才能查看脚本创建的日志。

Apps Script Documentation - Logging Requirements

你不能只添加:

console.log();

到你的脚本并让它工作。

来自" View"菜单,选择"控制台日志"

View - Console logs

系统将提示您启用控制台日志记录。

Enable Console Logging

答案 1 :(得分:1)

您需要添加到代码中

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

另请参阅此页面以获取更多信息:https://developers.google.com/apps-script/reference/base/logger