使用Google Apps脚本进行日志记录 [英] Logging with Google Apps script

查看:117
本文介绍了使用Google Apps脚本进行日志记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个有关使用应用程序脚本进行日志记录的问题:



1 /我有两个.gs文件(在同一个项目中)。一个(F1)通过 urlfetch (POST请求)调用另一个(F2)。 Logger.log 在F1中工作得很好,但不在F2中(也许它可以工作,但我无法检索日志)。你知道这是正常的还是我可以在哪里找到F2的日志?

(如果你想知道,是这样做的,所以我们可以多次并行地调用相同的函数)。

2 /我的脚本链接到Google Cloud项目,所以我已经看到我们可以通过Stackdriver检索一些日志。什么日志?因为那些 Logger.log 似乎从那里不可见。



感谢您的帮助

对于您的第二个问题:Stackdriver使用Apps脚本进行日志记录是一项新功能,只有申请的G Suite Business客户才可以访问该功能。 href =https://developers.google.com/apps-script/guides/logging#stackdriver_logging_early_access =nofollow noreferrer>早期访问权限
以下函数应该可以工作

  console.log([data] [,...])
console.info([data] [,...])
console.warn([data] [,...])
console.error([data] [,...] )
console.time([label])


I have two questions regarding logging with apps script:

1/ I have two .gs files (in the same project). One (F1) is calling the other (F2) via urlfetch (POST request). The Logger.log works just fine in F1, but doesn't in F2 (maybe it works too, but I just can't retrieve the logs). Do you know if it's normal or where can I find the logs of F2 ?
(If you're wondering, it's made this way so we can call the same function multiple times in parallel).

2/ My scripts are linked to a Google Cloud project and so I've seen we can retrieve some logs via Stackdriver. What logs ? Because those with Logger.log don't seem to be visible from there.

Thanks for your help

解决方案

Regarding your second question: Stackdriver Logging with Apps Script is a new feature, only accessible to G Suite Business customers that applied for early access. The following functions should work

console.log([data][,...])
console.info([data][,...])
console.warn([data][,...])
console.error([data][,...])
console.time([label])

这篇关于使用Google Apps脚本进行日志记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆