0

When a user makes a search on a site(where search product), I would like to see SQL request this search. How can I see him?

enter image description here

3
  • Donot understand your question.
    – Amit Bera
    Jun 7, 2019 at 15:10
  • Didn't get the question. Brief the question Jun 7, 2019 at 15:18
  • when a user makes a search on a site(where search product), I would like to see SQL request this search. How can I see him? Jun 10, 2019 at 9:41

1 Answer 1

1

Assuming this is just to do some quick debugging you can log all SQL by editing vendor/magento/framework/DB/Adapter/Pdo/Mysql.php and in function _query() after where you see

$result = parent::query($sql, $bind);

Add the line

file_put_contents("my.log", $sql, FILE_APPEND) ;

Run the search and then look in the website root for your log file (it will be pretty large)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.