Log Level Filtering for PHP Built-in Server
还没有人认领这个 Issue。
- 主要语言
- C
- 星标
- 40.4k
- 派生
- 8.2k
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 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:
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从由 php -S 调用的 PHP 8.3 内置服务器命令路径开始,跟踪请求日志和应用程序错误的输出方式。定义预期的日志级别过滤和 stdout/stderr 行为,然后添加覆盖测试,展示选定的消息会被过滤,并且标准日志与错误相分离。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- php
- 领域
- backend, cli
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100