Prevent Sequelize from outputting SQL to the console on execution of query? Prevent Sequelize from outputting SQL to the console on execution of query? node.js node.js

Prevent Sequelize from outputting SQL to the console on execution of query?


When you create your Sequelize object, pass false to the logging parameter:

var sequelize = new Sequelize('database', 'username', 'password', {    // disable logging; default: console.log  logging: false});

For more options, check the docs.


If 'config/config.json' file is used then add 'logging': false to the config.json in this case under development configuration section.

  // file config/config.json  {      {      "development": {        "username": "username",        "password": "password",        "database": "db_name",        "host": "127.0.0.1",        "dialect": "mysql",        "logging": false      },      "test": {    ...   }


As in other answers, you can just set logging:false, but I think better than completely disabling logging, you can just embrace log levels in your app. Sometimes you may want to take a look at the executed queries so it may be better to configure Sequelize to log at level verbose or debug. for example (I'm using winston here as a logging framework but you can use any other framework) :

var sequelize = new Sequelize('database', 'username', 'password', {  logging: winston.debug});

This will output SQL statements only if winston log level is set to debug or lower debugging levels. If log level is warn or info for example SQL will not be logged