Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show queries in console log using sails?

I am starting a project with sails and mysql, and I do'nt know how configurate it to show the queries executed in the console.

like image 530
demonodojo Avatar asked Mar 14 '14 09:03

demonodojo


2 Answers

This solution works for sails >= 1.1.

The sails-mysql (as of v1.0.0) adapter uses the machinepack-mysql driver which logs queries to debug. So all that's needed to log all native queries is to enable the debug flag:

DEBUG=query node app.js
like image 159
timcour Avatar answered Sep 18 '22 03:09

timcour


Unfortunately this isn't possible with Sails at this time, although the feature has been requested. Your best bet is to inspect the log file provided by your database:

Postgres: How to log PostgreSQL queries?

MySQL: Log all queries in mysql

MongoDB: MongoDB logging all queries

like image 42
sgress454 Avatar answered Sep 22 '22 03:09

sgress454