79549415

Date: 2025-04-02 00:23:39
Score: 0.5
Natty:
Report link

I believe you can redirect your logs to /dev/stderr as mentioned in docker's official documentation.

Sample code:

$stderr = fopen( 'php://stderr', 'w' );
fwrite($stderr, "Written through the PHP error stream" );
fclose($stderr);

This will output in the docker logs like this:

2025-04-02 09:00:27 Written through the PHP error stream
2025-04-02 09:00:27 192.168.65.1 - - [02/Apr/2025:00:00:27 +0000] "GET /log.php HTTP/1.1" 200 68 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36" "-"

And based from this Q&A, I was able to verify in my sample App Runner that the application logs are being written from PHP.

Application logs pt1. Application logs pt2.

Hope this helps,

Regards

Reasons:
  • Blacklisted phrase (1): Regards
  • Whitelisted phrase (-1): Hope this helps
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Tatachiblob