liveBook · Manning

SYSTEM$LOG_DEBUG

As explained in Snowflake Data Engineering

SYSTEM$LOG_DEBUG is a Snowflake system function that emits a message at the DEBUG logging level.

SYSTEM$LOG_DEBUG emits a message at Snowflake’s DEBUG logging level from a stored procedure. DEBUG is the least restrictive level, so it records DEBUG and higher-severity messages when the procedure’s log level permits it. section 4.4

Enable and inspect built-in logging through the account event table:

  • Create an event table and associate it with the Snowflake account. section 4.4
  • Grant the required account log-level privilege, then set the procedure log level to DEBUG. section 4.4
  • Call the procedure and query the event table to retrieve its messages. section 4.4
  • Wait several minutes before checking results because account-level logging can be delayed. section 4.4

Log the start of a stored-procedure load

Place SYSTEM$LOG_DEBUG('LOAD_CUSTOMER_ORDERS begin ') in the procedure before the MERGE operation, execute CALL LOAD_CUSTOMER_ORDERS(), and query BAKERY_EVENTS ordered by timestamp descending. section 4.4

Table 4.6 Comparison between custom logging and Snowflake built-in logging
Logging type
Benefits
Drawbacks
Custom
Flexibility in what information is needed and when it is logged
Must perform custom development
Snowflake built-in
There is no custom development; perform some initial setup, and call the Snowflake built-in logging constructs.
Shared across the account; therefore, access controls must be in place to allow developers to access their logging messages

Compare Snowflake built-in logging with custom logging, including setup effort, flexibility, and account-wide access-control implications. section 4.4

How Snowflake Data Engineering covers it

How deep it goes
Explains level configuration, procedure instrumentation, invocation, event-table querying, and delayed visibility.
Examples
Uses LOAD_CUSTOMER_ORDERS, a DEBUG message before MERGE, CALL execution, and a timestamp-ordered event-table query.
What it assumes
Assumes Snowflake stored-procedure and role familiarity while demonstrating event-table and log-level setup.
What you can do after
Operate/configure procedure logging and inspect emitted messages through an account event table.
How it connects
Connects stored procedures with logging levels, event tables, exception handling, and data pipelines.

This explainer was generated by Manning's knowledge graph from the text of Snowflake Data Engineering. The section links point to the parts of the book it draws on.