Seldaek / monolog

Sends your logs to files, sockets, inboxes, databases and various web services
https://seldaek.github.io/monolog/
MIT License
20.97k stars 1.9k forks source link

LogicException: Missing stream url #1322

Closed makstech closed 4 years ago

makstech commented 5 years ago

Hello!

I'm using Google Ads API PHP library with Laravel Queues/Jobs. But currently running only in synchronous way with dispatchNow() method. The thing is, I can't use queue, because problem occurs when trying to do it asynchronously, meaning launching the queue - produces LogicException:

LogicException: Missing stream url, the stream can not be opened. This may be caused by a premature call to close(). in \vendor\monolog\monolog\src\Monolog\Handler\StreamHandler.php:95
Stack trace:
#0 \vendor\monolog\monolog\src\Monolog\Handler\AbstractProcessingHandler.php(39): Monolog\Handler\StreamHandler->write(Array)
#1 \vendor\monolog\monolog\src\Monolog\Logger.php(344): Monolog\Handler\AbstractProcessingHandler->handle(Array)
#2 \vendor\monolog\monolog\src\Monolog\Logger.php(609): Monolog\Logger->addRecord(200, 'Request made: H...', Array)
#3 \vendor\googleads\google-ads-php\src\Google\Ads\GoogleAds\Lib\V1\GoogleAdsUnaryCallLogger.php(74): Monolog\Logger->log(200, 'Request made: H...', Array)
#4 \vendor\googleads\google-ads-php\src\Google\Ads\GoogleAds\Lib\V1\GoogleAdsLoggingUnaryCall.php(56): Google\Ads\GoogleAds\Lib\V1\GoogleAdsUnaryCallLogger->logSummary(Array, Array)
#5 \vendor\google\gax\src\Transport\GrpcTransport.php(242): Google\Ads\GoogleAds\Lib\V1\GoogleAdsLoggingUnaryCall->wait()

I already have opened an issue on Google's repo, but it doesn't seems to be a problem on their side. To be more specific, I've tried to comment out where logger is called (#3 on stack trace), and everything works fine but this is not desired behavior.

Thanks

dpereiraegoi commented 5 years ago

Hi,

This situation as been resolved?

MordiSacks commented 4 years ago

Same problem here. I ended up moving my logic into a command and calling it from the job.

surya-alive commented 4 years ago

here is my solution.