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

Unable to setup logging #751

Closed
michaelk1975 opened this issue Feb 24, 2022 · 11 comments
Closed

Unable to setup logging #751

michaelk1975 opened this issue Feb 24, 2022 · 11 comments
Assignees
Labels
bug Something isn't working

Comments

@michaelk1975
Copy link

[DO NOT INCLUDE ANY PERSONAL OR SENSITIVE DATA - MAKE SURE TO REDACT CONTENT WHEN NECESSARY]

Your client library and Google Ads API versions:

  • Client library version: v14.0.0
  • Google Ads API version: V10

Your environment:

Description of the bug:

I'm trying to enable logging:
Added the following to google_ads_php.ini:

[LOGGING]
logFilePath = my path
logLevel = “DEBUG"

Also performed 'chmod -R 777' on directory containing the log file.
But after running a request, the log file was empty.

Steps to reproduce:

Expected behavior:

Request/Response Logs:

Anything else we should know about your project / environment:

@michaelk1975 michaelk1975 added bug Something isn't working triage Need triage labels Feb 24, 2022
@PierrickVoulet
Copy link
Collaborator

Hi @michaelk1975,

We need more information about your environment to investigate.

Please provide the output generated by our complementary script: https://github.com/googleads/google-ads-php/blob/master/scripts/print_php_information.php.

Alternatively, please provide with the following pieces of information:

  • The PHP version: Run php -v.
  • The name and version of the operating system: Run php -r 'print php_uname();'.
  • Whether the PHP Extension protobuf is used or not: Run php -r 'print phpversion("protobuf");'.
  • Whether the PHP Extension grpc is used or not: Run php -r 'print phpversion("grpc");'.
  • The type of transport being used (grpc or rest): See https://developers.google.com/google-ads/api/docs/client-libs/php/transport.

@PierrickVoulet PierrickVoulet removed the triage Need triage label Feb 24, 2022
@michaelk1975
Copy link
Author

Hi @PierrickVoulet ,
Sorry, I thought I provided it.
See below:

PHP version: HP 7.4.18 (cli) (built: May 3 2021 11:26:48) ( NTS )
The name and version of the operating system: Linux saas-staging-161-20 4.15.0-46-generic #49-Ubuntu SMP Wed Feb 6 09:33:07 UTC 2019 x86_64
Protobuf command line returns nothing.
GRPC: 1.38.0
Type of transport: tried to specify both transport = "grpc" and transport = "rest" in google_ads_php.ini. When GRPC is sepcified, error is returned, so I suppose we are using rest.

@PierrickVoulet
Copy link
Collaborator

Thanks for providing the additional information. I think you are experiencing the same issue as #414 so I am closing this issue. Feel free to comment here if you think it is a different issue.

@michaelk1975
Copy link
Author

Thank you @PierrickVoulet ,

But grpc is installed in my case.
"php -i | grep grpc" returns:
grpc
grpc support => enabled
grpc module version => 1.38.0
grpc.enable_fork_support => 0 => 0
grpc.grpc_trace => no value => no value
grpc.grpc_verbosity => no value => no value
grpc.log_filename => no value => no value
grpc.poll_strategy => no value => no value

I wonder what is missing so...
When I'm setting "transport=grpc" in google_ads_php.ini, I'm getting the following error:
"gRPC support has been requested but required dependencies have not been found. For details on how to install the gRPC extension please see https://cloud.google.com/php/grpc"

@PierrickVoulet
Copy link
Collaborator

PierrickVoulet commented Feb 24, 2022

Could you confirm that you added the line extension=grpc.so to the php.ini file?

Another thing that could help is to install and configure protobuf (see the section requirements for instructions), could you give it a try?

@michaelk1975
Copy link
Author

Yes, extension=grpc.so is enabled.
After I enabled it I started to get another error:
"gRPC support has been requested but required dependencies have not been found. For details on how to install the gRPC extension please see https://cloud.google.com/php/grpc"

Protobuf is in composer.json and is installed:

composer info | grep protobuf

returns:

google/protobuf v3.19.4 proto library for PHP

@PierrickVoulet
Copy link
Collaborator

I still suspect a misconfiguration. Could you execute the following to make sure your system picks a valid configuration?

<?php
  echo extension_loaded('grpc') ? 'yes' : 'no';
  echo extension_loaded('protobuf') ? 'yes' : 'no';
?>

@michaelk1975
Copy link
Author

michaelk1975 commented Feb 24, 2022

Getting "no" and "no"
But according to error ("gRPC support has been requested but required dependencies have not been found") it seems like grpc is recognized, but some dependency is missing. Is there an option to get logs with "rest"?

@PierrickVoulet
Copy link
Collaborator

PierrickVoulet commented Feb 24, 2022

It appears that you select grpc as transport but the PHP extension grpc is not successfully loaded on your system.

You either need to use rest as transport (which comes with logging issues as per #414) or make sure the PHP extension grpc is installed and configured so that it is loaded at runtime when you execute the code.

@michaelk1975
Copy link
Author

Hi Pierrick,
I wonder what could cause grpc and protobuf to not be loaded... Both are returned when I'm running "php -m" command - I believe that it means that both extensions are installed properly. Please advise, what can I do (or check) to enable logging?

@PierrickVoulet
Copy link
Collaborator

PierrickVoulet commented Mar 2, 2022

Difficult to say without having access to the environments. If you have multiple PHPs installed on the machine you may want to double check that the one you execute is the one where you installed and configured the grpc and protobuf extensions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants