php - Symfony - 抑制特定端点的日志记录
问题描述
我有一个特定的端点,我在其中放置了一个空响应:
/**
* @Route("/ping", name="ping")
* @return JsonResponse
*/
public function gcpPingAction(): JsonResponse
{
return $this->json([], Response::HTTP_OK);
}
在我的日志中,我得到:
是否可以以某种方式抑制被命中的端点的日志记录?只是为了那个特定的端点..
解决方案
根据this,您应该可以这样做。
monolog:
handlers:
main:
# ...
type: fingers_crossed
handler: ...
excluded_http_codes: [{ 200: ['^/ping$'] }]
或者像这样
monolog:
handlers:
main:
# ...
type: fingers_crossed
handler: ...
excluded_http_codes:
- urls:
- '^/ping$'
但是,我没有测试它。
推荐阅读
- python - 如何使用自定义有效负载进行独立漏洞利用?
- ios - 如何删除 UITableViewCell 上的焦点环
- python - 抓取每个刮取部分的标题
- javascript - javascript 一行嵌套 if else 错误“:预期”
- android - 当我导航回它时,有没有办法更新我的列表视图页面?
- angular - 重定向时,我的数组在新页面上更新,然后视图消失,重定向后 1 秒
- amazon-web-services - 在将其转发到实际后端之前,我可以在 AWS API Gateway 中进行一些预处理吗?
- java - 从 UTC 时间戳转换时,为什么我总是收到错误的日期/时间?
- javascript - Javascript - 如何在四舍五入后显示带一位小数的整数
- python - 在 macOS 上启动 pygame 的问题在互联网上一无所获