简体   繁体   English

将 URL 参数添加到 Hostgator 上的 PHP 错误日志

[英]Add URL parameters to PHP error log on Hostgator

I've got a PHP error_log which return a few MySQL-errors, but in order to replicate and fix those, I need to be able to see which parameters were passed to the page.我有一个 PHP 错误日志,它返回一些 MySQL 错误,但为了复制和修复这些错误,我需要能够查看哪些参数被传递到页面。 I have tried to find this using both the PHP error_log file and the Apache logs from my Hostgator hosting, but cannot work out which one belongs to which, as the times don't seem to match up.我尝试使用来自我的 Hostgator 主机的 PHP error_log 文件和 Apache 日志来找到这个,但无法确定哪个属于哪个,因为时间似乎不匹配。 Is there a way to store the URL with parameters in the error_log, or is there a better way to do this?有没有办法在 error_log 中存储带有参数的 URL,或者有更好的方法吗?

Many thanks, Ron非常感谢,罗恩

have a look at using: 看一下使用:

error_log($url);
error_log($param1);

You should be able to push to the log any data you wish 您应该能够将所需的任何数据推送到日志

For multiple reasons, including that not all PHP errors may have been triggered from a web-based entry, error_log does not have a way to automatically log additional useful information.由于多种原因,包括并非所有 PHP 错误都可能由基于 Web 的条目触发, error_log无法自动记录其他有用信息。

For single instances you can log the information you need with error_log however I would suggest you use a logger and then modify the output.对于单个实例,您可以使用error_log记录所需的信息,但我建议您使用记录器,然后修改 output。 Monolog formatter is a solid choice. Monolog 格式化程序是一个不错的选择。

Alternatives would be something like rollbar that will gather the surrounding conditions so you can recreate the error.替代方案将是类似于rollbar的东西,它将收集周围的条件,以便您可以重新创建错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM