class Logger method .clear()

Logger is the Apps Script service.

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

What it does

Clears all messages from the execution log.

Why it's used

  • Wipe old debug output before a clean test run.
  • Reset logs when iterating locally.

Common errors

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

Explore

Related methods

  • .log()

    Writes a message to the execution log.

  • .getLog()

    Returns everything currently in the execution log.

Better Sheets tutorials

Scrape Google Maps

Scrape Google Maps

Scrape any query in Google Maps into your Google Sheets. Enter your API ...
Scrape Google Maps Added Phone and Reviews

Scrape Google Maps Added Phone and Reviews

Added two helper functions to get Phone numbers and reviews of the Googl...
Twitter App Clone in a Google Sheet

Twitter App Clone in a Google Sheet

I built a twitter clone in Google Sheets

Related blog posts

Written guides about Logger.clear().

Browse the blog