How to log all SQL query ?
See original GitHub issuevar mysql = require("mysql2");
const chalk = require('chalk');
...
pool.on("connection", function (connection) {
connection.on("enqueue", function (sequence) {
if ("Query" === sequence.constructor.name) {
console.log(chalk.green(`[+] mysql: ${sequence.sql}`));
}
});
});
...
I expect to see this on console:
[+] mysql: start transaction; insert into `entities` (`type`) values (3); insert into `companies` set `id` = last_insert_id(), `name` = 'google', `created_by` = 4, `url` = '/google2'; commit;
but nothing happens?
how to make it work on mysql2 ?
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
How to log ALL queries made by users in SQL Server 2017 ...
I need information (and/or source) if we need MS SQL 2017 Standard or Enterprise in order to ensure that the DB Admin's activities...
Read more >How to enable sql query logging - Microsoft Q&A
1. Queries are saved in the cache via system representations (sys.dm_exec_query_stats, sys.dm_exec_sql_text, and sys.dm_exec_query_plan) · 2.
Read more >Log all queries in mysql - Stack Overflow
Enable Query logging on the database. SET global general_log = 1; SET global log_output = 'table'; ; View the log. select * from...
Read more >General Query Log - MariaDB Knowledge Base
The general query log is a log of every SQL query received from a client, as well as each client connect and disconnect....
Read more >Logging all queries executed on MSSQL database
This can easily be done by the SQL Server Profiler, which gets shipped with the SQL Studio Express application of Microsoft. However, after ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
thank you for replying me, this question has been asked 3 years ago: https://github.com/sidorares/node-mysql2/issues/610#issuecomment-314933491 did you add this feature?
is it something that worked with
mysqljs/mysql
and does not work with mysql2?Before I start helping with “how to make this example work” can you please describe what you see and how it’s not matching what you want to see