php / php/php-src

Log Level Filtering for PHP Built-in Server

オープン
#16,855 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Feature SAPI: cli_server Status: Needs Triage
主要言語
C
スター
40.4k
フォーク
8.1k
平均マージ
2日 13時間
マージ済み PR(30日)
96

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

php -S によって呼び出される PHP 8.3 組み込みサーバーのコマンドパスから開始し、リクエストログとアプリケーションエラーがどのように出力されるかを追跡します。想定されるログレベルによるフィルタリングと stdout/stderr の動作を定義し、選択したメッセージがフィルタリングされ、標準ログとエラーが分離されることを示すテストカバレッジを追加します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
php
領域
backend, cli
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。