Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency on a non-existent logging service when EightPointsGuzzleBundle logging is disabled #6

Closed
Stollie opened this issue Oct 9, 2020 · 1 comment · Fixed by #7

Comments

@Stollie
Copy link

Stollie commented Oct 9, 2020

There is a dependency on the eight_points_guzzle logger class. When logging is disabled on eight_points_guzzle this class is not defined by the extension.

This gives the following error;

The service "guzzle_bundle_retry_plugin.middleware.retry.xxx" has a dependency on a non-existent service "eight_points_guzzle.middleware.log.class".

Location:

public function loadForClient(array $config, ContainerBuilder $container, string $clientName, Definition $handler): void
{
    if ($config['retry_enabled']) {
        $logger = new Definition(Logger::class);
        $logger->addMethodCall('setLogger', [new Reference('monolog.logger.eight_points_guzzle')]);
        $logger->addMethodCall('setFormatter', [new Reference('eight_points_guzzle.symfony_log_formatter')]);

        $middleware = new Definition(GuzzleRetryMiddleware::class);
        $middleware->setFactory([GuzzleRetryMiddleware::class, 'factory']);
        $middleware->setArguments([
            [
                'max_retry_attempts'               => $config['max_retry_attempts'],
                'retry_only_if_retry_after_header' => $config['retry_only_if_retry_after_header'],
                'retry_on_status'                  => $config['retry_on_status'],
                'default_retry_multiplier'         => $config['default_retry_multiplier'],
                'retry_on_timeout'                 => $config['retry_on_timeout'],
                'expose_retry_header'              => $config['expose_retry_header'],
                'retry_header'                     => $config['retry_header'],
                'on_retry_callback'                => [$logger, 'callback'],
            ],
        ]);
@Stollie
Copy link
Author

Stollie commented Oct 19, 2020

Or is the best solution to turn on logging?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant