Solved! How to Enable Magento 2 Database Logging

Enable Magento 2 database logger

Sometimes you just need Magento’s database to tell all, and a very easy way to accomplish this is with the following:

Note: We know this works on Magento 2.3.0 Open-Source running on an aMiSTACX deployment, but we are not sure how far back it will work for Magento 2 Open-Source.

From CLI:

Enable

cd /var/www/magento

sudo bin/magento dev:query-log:enable
sudo php bin/magento cache:clean

Disable

sudo bin/magento dev:query-log:disable
sudo php bin/magento cache:clean

Note: logs will be found in magento/var/debug/db.log and they will be large so don’t leave this on!

Wow! That was very easy 😉