private function logException(Exception $exception)
    {
        // Check if the error message should be logged or not
        if (in_array($exception->getStatusCode(), $this->doNotLog)) {
            return;
        }

        // Prepare log message
        $message = sprintf(
            'Uncaught exception of type %s thrown in file %s at line %s%s.',
            get_class($exception),
            $exception->getFile(),
            $exception->getLine(),
            $exception->getMessage() ? sprintf(' with message "%s"', $exception->getMessage()) : ''
        );
        // Log error
        $this->container['log']->error($message, array(
            'exception' => $exception,
            'Exception message'  => $message,
            'Exception line'  => $exception->getLine(),
            'Exception trace' => $exception->getTraceAsString(),
        ));
    }