简体   繁体   English

如何在 Apps 脚本仪表板中查看完整日志

[英]How to view full logs in Apps Script dashboard

The logs in my App Script dashboard are truncated;我的 App Script 仪表板中的日志被截断; I can only see the last X log entries.我只能看到最后 X 个日志条目。 I know the dashboard is supposed to be a simplified version, but is it possible to even get the full logs from the dashboard (or elsewhere) somehow?我知道仪表板应该是一个简化版本,但是否有可能以某种方式从仪表板(或其他地方)获取完整日志?

Answer:回答:

Google Apps Script has three different logs which persist for different amounts of time and contain different levels of information. Google Apps 脚本具有三种不同的日志,它们会持续不同的时间并包含不同级别的信息。

Further Information:更多信息:

As per the Apps Script documentation:根据 Apps 脚本文档:

Apps Script provides three different mechanisms for logging: Apps 脚本提供了三种不同的日志记录机制:

  • The built-in Apps Script Logger, which is lightweight but persists only for a short time.内置的 Apps Script Logger,轻量级但仅持续很短的时间。

  • The Stackdriver Logging interface in the Developer Console, which provides logs that persist for many days after their creation.开发者控制台中的 Stackdriver Logging 界面,提供在创建后保留多日的日志。

  • The Stackdriver Error Reporting interface in the Developer Console, which collects and records errors that occur while your script is running.开发者控制台中的 Stackdriver 错误报告界面,用于收集和记录脚本运行时发生的错误。

How to view:如何查看:

Logger.log():记录器.log():

Logs created this way can be made by using the Logger.log() line in the script, and can be viewed by selecting View > Logs in the script editor.可以使用脚本中的Logger.log()行来创建以这种方式创建的日志,并且可以通过在脚本编辑器中选择 View > Logs 来查看。

Stackdriver Logging: Stackdriver 日志记录:

When you requre logging that persists for a longer time than per-run, Stackdrier logs are preferred.当您需要比每次运行更长时间的日志记录时,最好使用 Stackdrier 日志。 These are attached to the GCP project that is associated with the Apps Script project, and a simplified version can be found in the Apps Script dashboard .这些附加到与 Apps 脚本项目关联的 GCP 项目中,可以在Apps 脚本仪表板中找到简化版本。 Exception logging can also be done via the Stackdriver logs.异常日志记录也可以通过 Stackdriver 日志完成。

Stackdriver Error Reporting: Stackdriver 错误报告:

You can view your Stackdriver error reports in the GCP console .您可以在GCP 控制台中查看 Stackdriver 错误报告。

References:参考:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM