Deactivate verbose log

Since a recent upgrade, log is verbose in dev environment by default.

Previously we had to set NODE_ENV=‘development’ to make it so.
Now for a large quantity of information, I can no longer visualize my own debug log since it’s replaced by sequelize querying logs.

How can I deactivate it ?

Thank you.

Hello @JeremyV,

Sorry for the inconvenience.

Could you please confirm which Forest agent you are using (forest-express-sequelize?) and which version made this change happen?

“forest-express-sequelize”: “^7.6.3”

I think it’s from a month ago when I updated from 6.7.11 to 7.6.3

@JeremyV, sorry for the wait.

Indeed, in the absence of value for “NODE_ENV” the application now defaults to logging: true in Sequelize options.
You can add NODE_ENV=production (or “staging”…) to your .env file to change this.

1 Like

Great ! Thank you @anon79585656 !

Hi @anon79585656

This way of deactivating verbose log is effective, but when I do so, it no longer transfers the .forestadmin-schema.json file to the FA front.

To do so, I have either to reactivate logs and restart my local server, or use the forest CLI to manually transfer the file.

if I remember correctly. it might be something like
forest schema:apply

Am I correct ? Is there any automatic workaround to avoid extra manual transfer ?

Hello @JeremyV,

You do two more things to remove the logs.

  1. In the app.js file of your agent, you can comment the app.use(morgan('tiny')); line
  2. In the config/databases.js (or models/index.js if using an older version) you can set databaseOptions.logging to false

Given your initial screenshot, I think you are looking for case 2.

You can simply set it to false or using something more flexible like using process.env.SKIP_SQL_LOGS and setting this variable in your environment before starting your agent.

You’ll have to tinker a bit to make it suit your needs, but it will be easier Thant manually using forest schema:apply.

Hope this helps.

2 Likes

Thanks for your insight @anon79585656