问题
In my google app script, I have:
Logger.log("test");
and I even tried
console.log("test");
But neither is printed to the stackdriver log, even after I've set the project id to a Google Cloud Project id.
The screen shows:
回答1:
To being able to see the logs on Stackdriver your project should have linked to a Google Cloud Standard project instad of the default project otherwise you only could see the "Stackdriver logs" on the executions pages in https://script.google.com
From https://developers.google.com/apps-script/guides/logging#using_stackdriver_logging
Using Stackdriver Logging
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.
来源:https://stackoverflow.com/questions/62010980/no-logs-are-created-in-stackdriver-logging