Google Script Logging

Google Script logging

Google Apps Script is an administration given by Google that permits little bits of JavaScript that can associate with other Google Services and different administrations that give an electronic API. The Apps Script can be activated dependent on web demands, Google Forms, Google Sheets, Google Docs, or, most curiously, a clock. The time-sensitive triggers are incredibly helpful as they enable us to timetable undertakings every day, week after week, or month to month at explicit occasions, like outdated corn occupations. Thusly, we can run bunch occupations to associate data sources, for example, Salesforce and Google Analytics, naturally.


Google Apps Script has consistently given a basic logging apparatus—the Logger administration—to enable engineers to more likely test their contents. This works for some, basic use cases, yet engineers need different approaches to log messages and blunders, especially when:

  • Investigating or examining contents over different executions
  • Taking a shot at a content or extra with numerous clients
  • Searching for patterns or bits of knowledge about their contents and clients

To make Apps Script a friendlier situation for engineers, we are declaring general accessibility of another combination with Google Stack driver. This is notwithstanding the previous Logger administration, which is yet accessible.

When building up any sort of application, you frequently need to log data to help analyze flaws during improvement, to recognize and analyze client issues, and for different purposes.

Applications Script gives the following unique components to logging:

  • The inherent Apps Script Logger, which is lightweight, however, perseveres just for a brief timeframe.
  • The Stack driver Logging interface in the Developer Console, which gives logs that persevere to numerous days after their creation.
  • The Stack driver Error Reporting interface in the Developer Console, which gathers and records mistakes that happen while your content is running.

A fundamental way to deal with signing in Apps Script is to utilize the worked in Logger. Logs made along these lines can be seen by choosing View > Logs in the content proofreader. These logs are planned for basic checks during advancement and investigating, and don’t continue extremely long.

As you can see the following function:

google script logging

Utilizing Stack driver Logging

Stack driver logs are joined to the GCP task related with your Apps Script. You can see an improved rendition of these logs in the Apps Script dashboard. To utilize Stack driver Logging and its abilities, utilize a standard GCP venture with your content task. This gives you a chance to get to Stack driver logs legitimately in the GCP Console and gives you more survey and separating choices.

When logging, it is great security practice to abstain from chronicle any close to home data about the client, for example, email addresses. Stack driver logs are consequently marked with dynamic client keys you can use to find a client’s log messages when essential.

You can log strings, arranged strings, and even JSON articles utilizing the capacities given by the Apps Script support administration.

Applications Script Logger isn’t intended for long haul logging – it is intended for the present moment (for example single-occasion/conjuring lifetime) troubleshooting. Different Apps Script assembled ins, for example, Stack driver Logging through comfort, offer a more extended term logging period. If you need to really store the logs uncertainly, you should serialize the substance (for example compose the logs to a spreadsheet or other record). A case of this for the Logger class:

Related Articles


Your email address will not be published. Required fields are marked *