7

How can I make Sequelize ORM silent on logging sql command?

I am using acl-sequelize library:

var Acl = require('acl');
var Sequelize = require('sequelize');
var AclSeq = require('acl-sequelize');
var db = new Sequelize('mysql://root@localhost:3306/test');   
var acl = new Acl(new AclSeq(db, { prefix: 'acl_' }));

How can I make it silent?

Alvin
  • 8,219
  • 25
  • 96
  • 177
  • 1
    I believe this was already answered here: http://stackoverflow.com/a/28927913 – XAE Mar 26 '16 at 05:43

2 Answers2

6

In Options you will need to set logging to false

var sequelize = new Sequelize('db_name', 'user', 'password', {host:host, dialect:"mysql", logging:false});
Keval
  • 3,246
  • 20
  • 28
0

You can pass the logging option to the Sequelize constructor and set it to false to disable logging SQL commands. Here's how you can modify your code:

var Acl = require('acl');
var Sequelize = require('sequelize');
var AclSeq = require('acl-sequelize');
var db = new Sequelize('mysql://root@localhost:3306/test', { logging: false });   
var acl = new Acl(new AclSeq(db, { prefix: 'acl_' }));

This will prevent Sequelize from logging SQL commands to the console.