You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
warn as log level seems to not work, warning however works. warn is the default when Laravel's environment is non-local. According to RoadRunner's example .rr.yaml file, warn is listed as one of the accepted values for logs.level.
error does not work at all and will not log any errors (for some reason)
debug, info and warning seems to log messages of all log levels. So setting --log-level=warning will still yield messages logged with Log::debug()
I have always found it strange that error is rarely outputted to the main process window when running Octane, so I started diving into this. It is especially important to have in debugging stages when hosting via Kubernetes and using either kubectl logs or some external logging service that pulls the kubernetes logs.
After some testing I found that I could get the logs shown by forcing --log-level=info, and later on I also figured out that warning would work.
The downside is that it also logs every single incoming request to the application as well. There does not seem to be any way to disable that part of the logging.
To sum up:
log-level=debug, log-level=info, log-level=warning: works, logs all log levels, even though some of them should not log lower log level messages
log-level=warn (default): does not log anything
log-level=error: does not log logs for any log levels
I also just noticed that when running Octane with --log-level=warning, this line should probably not be true but it still seems to be so. Dumping the raw data just before yields that it's level is info even though I have tried forcing it to warning 🤔
Octane Version
2.6.0
Laravel Version
11.39.0
PHP Version
8.4.3
What server type are you using?
Roadrunner
Server Version
2024.3.2
Database Driver & Version
sqlite
Description
Upon investigating this I have found that:
warn
as log level seems to not work,warning
however works.warn
is the default when Laravel's environment is non-local. According to RoadRunner's example.rr.yaml
file,warn
is listed as one of the accepted values forlogs.level
.error
does not work at all and will not log any errors (for some reason)debug
,info
andwarning
seems to log messages of all log levels. So setting--log-level=warning
will still yield messages logged withLog::debug()
I have always found it strange that error is rarely outputted to the main process window when running Octane, so I started diving into this. It is especially important to have in debugging stages when hosting via Kubernetes and using either
kubectl logs
or some external logging service that pulls the kubernetes logs.After some testing I found that I could get the logs shown by forcing
--log-level=info
, and later on I also figured out thatwarning
would work.The downside is that it also logs every single incoming request to the application as well. There does not seem to be any way to disable that part of the logging.
To sum up:
log-level=debug
,log-level=info
,log-level=warning
: works, logs all log levels, even though some of them should not log lower log level messageslog-level=warn
(default): does not log anythinglog-level=error
: does not log logs for any log levelsReproduction repo: https://github.com/carestad/laravel-octane-logging-stderr
Steps To Reproduce
In
routes/web.php
:Create a new Laravel application:
laravel new octante-test
Install Octane:
php artisan octane:install --server=roadrunner
Run Octane with defaults:
php artisan --env=production octane:start --server=roadrunner
Then test by sending a request to
/log
. Nothing should be logged.Then try re-running Octane with log level
warning
instead:php artisan --env=production octane:start --server=roadrunner --log-level=warning
And re-send request to
/log
. Should log entry now.Note: we need to force env to be
production
, otherwise Octane falls back tolog-level=debug
according to https://github.com/laravel/octane/blob/2.x/src/Commands/StartRoadRunnerCommand.php#L94The text was updated successfully, but these errors were encountered: