TL;DR: I'm using the Nette Tracy library that creates a summary (.log) and a detailed (.html) file on any errors that occur, and I'm attempting to upload them to AWS S3. The .log file appears successfully but the .html file is nowhere to be seen.
I'm using the Nette Tracy library and trying to upload all output to an S3 bucket.
So far I've created the S3 wrapper and manually triggered an exception to test it out but it only succeeds in part. The S3 wrapper exists and works in part as an initial "overview" document (error.log) is successfully created - it's just the HTML document that's not appearing. It works fine with local storage, but S3 would be preferred.
When it tries to log the actual exception details itself (a HTML file) the fopen function returns false. As a result, false is returned from the function too (function below) and the file isn't created.
In the error.log file that is actually uploaded, the below is recorded (bucket name and path removed):
PHP Warning: fopen(s3:\BUCKET\debug\tracy\exception--2019-07-07--00-30--459a553c82.html): failed to open stream: No such file or directory in C:\path\to\file\tracy\Tracy\BlueScreen\BlueScreen.php:97 @ http://mydevelopment.site
Not really sure where to go from here? Any help pointers appreciated!
This is the code which is part of the Tracy library that records the full exception/error details:
/**
* Renders blue screen to file (if file exists, it will not be overwritten).
*/
public function renderToFile(\Throwable $exception, string $file): bool
{
if ($handle = @fopen($file, 'x')) {
ob_start(); // double buffer prevents sending HTTP headers in some PHP
ob_start(function ($buffer) use ($handle): void { fwrite($handle, $buffer); }, 4096);
$this->renderTemplate($exception, __DIR__ . '/assets/page.phtml', false);
ob_end_flush();
ob_end_clean();
fclose($handle);
return true;
}
return false;
}