Apps Script公式リファレンス: Apps Script Reference |障害・課題追跡: IssueTracker |Google Workspace: Status Dashboard - Summary

2018年7月16日月曜日

console.log()でGoogle Cloud Platformにログを出す(Stackdriver Logging)


Logger.logでは省略されるログをStackdriver Loggingで出せることを知ったので備忘録として書き残しておきます。

※この記事を書いた後に仕様変更があり、新しく作られたスクリプトプロジェクトからStackdriverのログに直接アクセスするには、標準のGCPプロジェクトを使用する必要があるようです。
Stackdriver logs are attached to the GCP project associated with your Apps Script. You can view a simplified version of these logs in the Apps Script dashboard. To make full use of Stackdriver Logging and its capabilities, use a standard GCP project with your script project. This lets you access Stackdriver logs directly in the GCP Console and gives you more viewing and filtering options.
using_stackdriver_logging



コード.gs内でconsole.log("出したいログ")を書いて
myFunctionを実行して


表示>Stackdriver Loggingを開くと

このようにログを出せる



補足




コード.gs
function myFunction() {
  console.log("出したいログ");
}


参考

Latest post

Google Apps Scriptの障害時はIssueTrackerを見てみる - Incidents for Apps Script are reported on Issue Tracker

IssueTracker > Apps Script issues https://issuetracker.google.com/savedsearches/566234 Google Apps Scriptの障害時は IssueTracker に課題が上がっていることが...