public function setupLogging(Event $event)
    {
        foreach ($this->_getSources() as $connectionName) {
            try {
                $connection = $this->_getSource($connectionName);

                if (method_exists($connection, 'enableQueryLogging')) {
                    $connection->enableQueryLogging(true);
                } else {
                    $connection->logQueries(true);
                }

                $connection->setLogger(new QueryLogger());
            } catch (MissingDatasourceConfigException $e) {
                //Safe to ignore this :-)
            }
        }
    }