php / php-src

The PHP Interpreter
https://www.php.net
Other
38.27k stars 7.76k forks source link

Log Level Filtering for PHP Built-in Server #16855

Open kyesil opened 3 days ago

kyesil commented 3 days ago

Description

Hi, We use the PHP 8.3 built-in server during development, and it has been very helpful. However, there is an excessive amount of stdout output. For every request to resources like images, JS, or CSS files, it logs messages such as Accepted, GET, Closing, etc.

Because of this, it becomes very difficult to see the stdout output or error messages from within the application itself. I couldn't find an option to filter these logs. A feature like loglevel could be helpful to manage this.

For example: php -S 0.0.0.0:8086 -t ./public --loglevel 4

This would allow filtering logs based on levels (e.g., errors, warnings, info, etc.), making it easier to focus on application-specific outputs during development.

Additionally, the PHP built-in server outputs all logs to stderr, which seems like a bug. Ideally, standard logs should go to stdout and error messages to stderr.

PHP built-in server output like: phpbuiltinserver