PHP Standard 1st-gen to Flexible 2nd-gen - Logging is not as in-depth

Hey there, on my current installation of using App Engine 1st Generation PHP 5.5; the logging is a great feature and is heavily utilised. Now that we are forced to update to Flexible 2nd-generation on the latest PHP; the logs are hard to navigate, we’ve had to swap over from using the plain old **syslog** to the PSR Cloud Logger. My understanding there was a hook for the syslog that uses the gRPC API to communicate with stackdriver however I can’t find that source-code easily.

Due to upgrading we are losing valuable debugging insights which has let us continuously provide a good quality of service

For example here is a payload example of 1st Gen request in PHP5.5 using plain old syslog throughout the code.

Notice how all of our syslogs for that 1 request appear under the lines property.

Now on Flexible 2nd-gen; here is how they are currently. Each log goes into it’s own request which makes tracing a particular user a nightmare.

I have tried many configuration options such as including an insertId - it makes debugging requests very difficult as there is a lot of noise with other unrelated requests and it is hard to determine which particular request I am looking at as multiple occur with each user interaction. I can apply a TraceID but we lose a lot of information such as being able to query the logs by a particular user.

For example on 1st gen I am able to see all requests by a particular user as we do each request with a syslog(LOG_INFO, “u;<>”); -

On 2nd gen since the logs are split up, it makes it near impossible to track what the user is doing. We would have to use search by “trace” however that is ineffective as there are multiple network requests happening and in parallel to so the order of logs is a bit mixed.

This is making the debugging effort very hard - I would love for any suggestions on how to make the 2nd Gen stack-driver log integration work like the “legacy” 1st-gen.

Would love to be able to have the same visibility into logging as I do on the Standard 1st Gen PHP5.5.

Thanks for reading.

Hi @Dimitri-A ,

Welcome to the Google Cloud Community!

Have you considered using a third party tool like OpenTelemetry (formerly OpenConsensus)?

OpenTelemetry provides a set of APIs and libraries that can capture distributed traces and metrics from your application, which can help you correlate logs, trace requests, and gain insights in your application[1].

You may review this document, Setting up Cloud Trace for PHP, for more information.

I hope this helps. Thanks.

[1]. https://opentelemetry.io/docs/instrumentation/php/getting-started/