class Logger method .log()

Logger is the Apps Script service.

.log() is the method name you will see after a dot in your code.

What it does

Writes a message to the execution log.

Why it's used

  • Leave breadcrumbs while debugging a tricky trigger.
  • See values in Executions when something fails in production.

Common errors

  • Forgetting parentheses on log. Write Logger.log(), not Logger.log or log by itself.
  • Skipping dots between chained calls. Each step needs a dot, like Logger.log().
  • Adding spaces where they do not belong. Write Logger.log(), not Logger .log(), Logger.log (), or Logger . log().
  • Wrong capitalization. Use Logger and log, not logger or log.

Explore

Related methods

  • .clear()

    Clears all messages from the execution log.

  • .getLog()

    Returns everything currently in the execution log.

Better Sheets tutorials

2 New Ways To Add Emoji Reactions

2 New Ways To Add Emoji Reactions

 Revolutionize the way you react with emojis! Discover two new methods t...
Add Click Tracking To Your Google Sheets | Bitly in a Google Sheet

Add Click Tracking To Your Google Sheets | Bitly in a Google Sheet

Create a click Edit: Google changed how the redirect is handled. It no l...
Add Tasks to Google Tasks From Google Sheets

Add Tasks to Google Tasks From Google Sheets

Create tasks in Google Tasks from Google Sheets using Apps Script
Automate Form Response to Confirmation Email

Automate Form Response to Confirmation Email

Create an email automatically when someone fills out a google form. incl...
Automate Google Sheets With Zero Experience

Automate Google Sheets With Zero Experience

By the end of this video you should be knowledgeable about how to automa...
Automate Help Desk Ticket Closing

Automate Help Desk Ticket Closing

Create a simple automated help desk ticketing system. • Create tickets C...
Automatically Backup a Spreadsheet

Automatically Backup a Spreadsheet

Make a copy and rename to BACKUP plus the Date of the backup. Execute th...
Basic CRM - Add a Powerful Script To Move Row Based on Status

Basic CRM - Add a Powerful Script To Move Row Based on Status

we're going to be adding a very powerful script to our CRMs or any datab...

Related blog posts

Written guides about Logger.log().

Browse the blog