CakePHP 4.x: クエリログを出す方法

// logs/queries.log にクエリログを出力
$connection->enableQueryLogging(true);

コントローラ内であれば、こんな感じ

$this->テーブル名->getConnection()->enableQueryLogging();

※3.x では $this->テーブル名->getConnection()->logQueries(true); だったが、logQueries() は 4.x で削除された。

ドキュメント