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

No tagged tutorials yet. Fetch Apps Script from the harvest table and this page fills automatically.

Related blog posts

Written guides about Logger.clear().

Browse the blog