Back in M1 you could log the slow queries by modifying the following variables in lib/Varien/Db/Adapter/Pdo/Mysql.php
:
/**
* Write SQL debug data to file
*
* @var bool
*/
protected $_debug = false;
/**
* Minimum query duration time to be logged
*
* @var unknown_type
*/
protected $_logQueryTime = 0.05;
/**
* Log all queries (ignored minimum query duration time)
*
* @var bool
*/
protected $_logAllQueries = false;
/**
* Add to log call stack data (backtrace)
*
* @var bool
*/
protected $_logCallStack = false;
/**
* Path to SQL debug data log
*
* @var string
*/
protected $_debugFile = 'var/debug/sql.txt';
So I'm wondering how can I do that in M2? I've found some interesting stuff in lib/internal/Magento/Framework/DB/Logger/LoggerAbstract
as well as lib/internal/Magento/Framework/DB/Logger/File
but I ain't 100% sure how to tackle this.