Node-mssql: How to log each request

Created on 6 Nov 2017  路  1Comment  路  Source: tediousjs/node-mssql

Maybe a stupid question, but I haven't been able to find an answer combing through the docs, google, and the issues:

How can I console.log each sql statement executed? (for debugging purposes, of course).

I usually use Sequelize, and with Sequelize it is just a matter of setting config.logging = true (or a custom function if you want). But I don't see anything that can do the same thing just using mssql.

Most helpful comment

node-mssql uses the debug package (with 'mssql:tedious' or 'mssql:msnodesql') so you can do DEBUG=mssql:* node app.js to make it print the sql statements.

Example output:

  mssql:tedious req: query: SELECT * FROM TestTable WHERE TestColumn = @Value +0ms
  mssql:tedious req: query ok +328ms

>All comments

node-mssql uses the debug package (with 'mssql:tedious' or 'mssql:msnodesql') so you can do DEBUG=mssql:* node app.js to make it print the sql statements.

Example output:

  mssql:tedious req: query: SELECT * FROM TestTable WHERE TestColumn = @Value +0ms
  mssql:tedious req: query ok +328ms
Was this page helpful?
0 / 5 - 0 ratings