8p / EightPointsGuzzleBundle

⛽️ Integrates Guzzle 6.x, a PHP HTTP Client, into Symfony
MIT License
440 stars 71 forks source link

Request/Response are not being logged #99

Closed orasik closed 6 years ago

orasik commented 7 years ago

I am using the bundle with following config:

guzzle:
    logging: true
    clients:
        my_client:
            base_url: "https://myurl.tld/"
            options:
                headers:
                    Accept: "application/json"
                timeout: 30

php version PHP 7.0.16 Guzzle bundle version: "eightpoints/guzzle-bundle": "^5.3"

I can not see any request/response in log files. Am I missing any configuration?

The context is I am using a wrapper service and call it from symfony Command. I also tried to call service from controller directly without wrapper and still can not see any logs.

Code inside controller:

$service = $this->get('guzzle.client.my_client');
        try{
            $val = $service->post('endpoint', ['key' => 'value']);
            var_dump($val);

        } catch (\Exception $ex) {
           echo $ex->getMessage();
        }

Can you please help?

Kind Regards, Oras

TheLuckyOne commented 7 years ago

same question

samvdb commented 7 years ago

The logger is only used for the profiler. If you look in the code you will see the data collector grabbing all the logs. This means that monolog is not injected but a custom logger class which does not log to files.

gregurco commented 6 years ago

@orasik @TheLuckyOne implemented in PR #163 :slightly_smiling_face:

florianpreusner commented 6 years ago

Released in v7.3.0 (https://github.com/8p/EightPointsGuzzleBundle/releases/tag/7.3.0)