Configuring log levels and files

The Node.js driver supports two types of loggers to track activity:

  • Browser logger, which stores logs in an in-memory buffer within the browser.

  • Node logger, which by default, stores logs in a snowflake.log file and displays them in the console.

You can use the following code to switch from the browser logger to the node logger. This example switches to the node logger and sends messages to the console.

Logger.setInstance(new NodeLogger({ filePath: 'STDOUT'}));

Supported log levels

The Node.js driver supports the following log levels:

  • OFF



  • INFO



Configure the default logging behavior

You can configure standard logging by calling snowflake.configure, similar to the following:

const snowflake = require('snowflake-sdk');

snowflake.configure: {
  logLevel: "INFO",
  filePath: "/some/path/log_file.log"
  additionalLogToConsole: false


  • logLevel is the desired logging level.

  • filePath is the location of the log file or STDOUT for console output.

  • additionalLogToConsole is a Boolean value that indicates whether to send log messages also to the console when a filePath is specified. Default: true.

Use easy logging while debugging your code

When debugging an application, increasing the log level can provide more granular information about what the application is doing. The Easy Logging feature simplifies debugging by letting you change the log level and the log file destination using a configuration file (default: sf_client_config.json).

You typically change log levels only when debugging your application.

This configuration file uses JSON to define the log_level and log_path logging parameters, as follows:

  "common": {
    "log_level": "INFO",
    "log_path": "/some-path/some-directory"


  • log_level is the desired logging level.

  • log_path is the location to store the log files. The driver automatically creates a nodejs sub-directory in the specified log_path. For example, if you set log_path to /Users/me/logs, the drivers creates the /Users/me/logs/nodejs directory and stores the logs there.

The driver looks for the location of the configuration file in the following order:

  • clientConfigFile connection parameter, containing the full path to the configuration file, such as the following:

    const snowflake = require('snowflake-sdk');
    var connection = snowflake.createConnection({
      account: account,
      username: user,
      password: password,
      application: application,
      clientConfigFile: '/some/path/client_config.json'
  • SF_CLIENT_CONFIG_FILE environment variable, containing the full path to the configuration file (e.g. export SF_CLIENT_CONFIG_FILE=/some_path/some-directory/client_config.json).

  • Node.js driver installation directory, where the file must be named sf_client_config.json.

  • User’s home directory, where the file must be named sf_client_config.json.


To enhance security, the driver requires the logging configuration file on Unix-style systems to limit file permissions to allow only the file owner to modify the files (such as chmod 0600 or chmod 0644).

To minimize the number of searches for a configuration file, the driver reads the configuration file only:

  • for the first connection.

  • for the first connection using the clientConfigFile parameter.