Move Database::startLog('webprofiler'); to a new middleware to ensure collecting all queries