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 Formsで記述式の質問に字数制限を設定したい

記述式の質問には「回答の検証」を設定することができます フォームの編集画面 右下の︙メニューで「回答の検証」を選択します 検証方法には「数値」「テキスト」「長さ」「正規表現」という種類があります 今回は字数制限したいので「長さ」を選びます 長さには「最大文字数」か「最小文字数」を...