How to disable sequelize cli log - Sequelize CLI [Node: 10.21.0, CLI: 6.0.0, ORM: 6.1.0]

Question

I am using sequelize cli to configure postgresql and run migrations/seeders. There are a couple of logs being printed unnecessarily and might also reveal internals of my service. I would want to suppress these logs. The logs seen are as follows.

  1. Loaded configuration file "src/infrastructure/config/config.js".
  2. [4mSequelize CLI [Node: 18.14.2, CLI: 6.6.2, ORM: 6.35.2][24m
  3. No seeders found.

Also, FYI, I have already tried adding logging false in config file, which isn't working.

~~~text
~~~text
{
  "development": {
    "username": "username",
    "password": "password",
    "database": "db_name",
    "host": "127.0.0.1",
    "dialect": "mysql",
    "logging": false
  },
  "test": {
    // ...
  }

}

Answer

The way you have setup to disable logs appears to be correct, however you can also specify the "logging:false" directly where you create your Sequelize connection like below:

`sequelize = new Sequelize(process.env[config.use_env_variable], {
      timezone: config.db_configs.timezone,
      logging: false, //specify logging false here
    });`

This answer was originally posted on Stack Overflow. You can find the full discussion here

Related Posts

Transfer git repositories from GitLab to GitHub - can we, how to and pitfalls (if any)?

## Question Can one transfer repositories from GitLab to GitHub if the need be. If so, how exactly can I go about doing the same? Also, are there any pitfalls in doing so or precautionary measures

Read More

Cannot set headers after they are sent to the client - error

## Question Error `[ERR_HTTP_HEADERS_SENT]`: Cannot set headers after they are sent to the client ```text `at ServerResponse.setHeader (_http_outgoing.js:558:11) at ServerResponse.header (D:\D

Read More

Pulling data with 'Where' and 'Include' statements at the same time

## Question I have managed to get my include statements working with my foreign keys however when I try to add a 'where' statement to the findAll statement I am getting the below error. I have check

Read More