-
-
Notifications
You must be signed in to change notification settings - Fork 251
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
Help needed: No output from php://stdout in frankenphp log #1227
Comments
When logging to stdout, don't you have to use a configuration like this?
|
It's because laravel octane runs frankenphp as a sub process and then forwards the output. I just run it directly with a custom caddyfile. Much less hassle. # in the dockerimage.
CMD ["frankenphp", "run", "-c", "/etc/caddy/Caddyfile"] And a custom bootstrap stub in <?php
// These env vars are required for the octane bootstrap file to work.
$_SERVER['MAX_REQUESTS'] = $_SERVER['LARAVEL_OCTANE_MAX_WORKER_REQUESTS'];
$_SERVER['REQUEST_MAX_EXECUTION_TIME'] = $_SERVER['LARAVEL_OCTANE_MAX_EXECUTION_TIME'];
$_SERVER['APP_BASE_PATH'] = dirname(__DIR__);
$_SERVER['APP_PUBLIC_PATH'] = $_SERVER['APP_BASE_PATH'].'/public';
require dirname(__DIR__).'/vendor/laravel/octane/bin/frankenphp-worker.php'; |
Looks great, could you please share your Caddy file. Thanks.
07.12.2024 15:15:49 Calvin Alkan ***@***.***>:
…
It's because laravel octane runs frankenphp as a sub process and then forwards the output.
I just run it directly with a custom caddyfile. Much less hassle.
# in the dockerimage.
CMD ["frankenphp", "run", "-c", "/etc/caddy/Caddyfile"]
And a custom bootstrap stub in *public/frankenphp-worker.php*
<?php
// These env vars are required for the octane bootstrap file to work.
$_SERVER['MAX_REQUESTS'] = $_SERVER['LARAVEL_OCTANE_MAX_WORKER_REQUESTS'];
$_SERVER['REQUEST_MAX_EXECUTION_TIME'] = $_SERVER['LARAVEL_OCTANE_MAX_EXECUTION_TIME'];
$_SERVER['APP_BASE_PATH'] = dirname(__DIR__);
$_SERVER['APP_PUBLIC_PATH'] = $_SERVER['APP_BASE_PATH'].'/public';
require dirname(__DIR__).'/vendor/laravel/octane/bin/frankenphp-worker.php';
—
Reply to this email directly, view it on GitHub[#1227 (comment)], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AH5DYOZXCF6GOSKNH3DUVF32EL7JJAVCNFSM6AAAAABTESXGKKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMRVGE4DGMBXGM].
You are receiving this because you authored the thread.
[Verfolgungsbild][https://github.com/notifications/beacon/AH5DYO2MPLLK5RDRTBBAP6D2EL7JJA5CNFSM6AAAAABTESXGKKWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUWQM6GC.gif]
|
|
Had the same issue a while ago, logging to stderr instead of stdout solved the issue for us. As log levels are set explicitly anyhow, this does not affect logging services. |
Hi,
I have a simple app with PHP 8.3/Laravel/Octane which I want to put in container. I use Laravel sample logging config 'single':
Starting this app (without container) with:
php artisan octane:frankenphp --log-level=debug
produces caddy access log, but no application logging is shown.
If I set path to 'php://stderr' - it works as expected. Of course it works as well if I log to a file.
Is there some configuration I am missing to emit application log on stdout to caddy/frankephp logger?
The text was updated successfully, but these errors were encountered: