I can find out that certain query has been fired to MySQL database from the mysqlBinLog. But is there a way to find which PHP file has executed those queries ?
My problem is- I am not able to trace which php file in the Application is firing a particular update query.
I have searched in the whole application for that particular update query but I didn’t find any match. It is generated programatically somewhere and get executed.
Since the code footprint is too big, it is practically not possible for me to go and put a log statement everywhere.
You can wrap a logger class around the database access library (PDO) and log the query together with a backtrace.
You can add other methods that need logging too, such as
prepare()orexecute().If you’re using
mysql_functions, good luck 🙂