question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to log each request

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

8reactions
flaviojscommented, Nov 12, 2017

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
0reactions
dhensbycommented, Aug 8, 2022

https://github.com/tediousjs/tedious/issues/713 seems slightly unrelated, that’s asking more about resolving stored procedures to their underlying query at execution time.

This issue is no longer open because it is possible using the DEBUG library.

If you have an SQL syntax error, the best thing to do is get your debugger out and see what’s going wrong if you can’t determine it by inspecting the code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring Boot - How to log all requests and responses with ...
You can use Actuator in Spring Boot. It logs requests and responses and more information about servlet and system operating ...
Read more >
Spring - Log Incoming Requests - Baeldung
In this quick tutorial, we'll demonstrate the basics of logging incoming requests using Spring's logging filter.
Read more >
Should I be logging every request in a web application?
I would say both yes and no, and here's why. Yes, all requests should be logged. No, you should not be logging them....
Read more >
Log request and responses of REST APIs in SpringBoot
Today we will see a way to log requests and responses of APIs without inserting logger messages in each controller method of a...
Read more >
Log Incoming Requests In Spring - Java Development Journal
How to Log Incoming Requests In Spring. In this post, we will explore as of how to Log Incoming Requests In Spring.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found