php - 使用 PHP 设置 Sentry

标签 php sentry

我正在尝试设置 Sentry 的简单测试用PHP。我尝试通过下载并解压缩 latest sentry-php archive 来手动安装它到我的项目文件夹。

我一直在关注 PHP Instructions ,并设置了一个简单的单页 php 文件,我认为它可以显示 Sentry 正在工作。我包含了对不存在的文件的引用以生成 PHP 错误。我知道我到 Raven/Autoloader.php 的路径是正确的,因为我测试了从该文件顶部回显消息。

我已经设置了一个 Sentry 帐户和项目,并确保来自 Sentry 客户端 key 页面的我的 DNS 包含在 $client = new Raven_Client 语句中。

我已经在本地和托管测试服务器上尝试过该文件。 Sentry 中没有记录任何错误或消息。转到我的 Sentry 项目的问题页面,它说它正在等待事件。

谁能建议为什么关注测试页面不起作用?

<html>
 <head>
  <title>PHP Sentry Test</title>
 </head>
 <body>
 <?php 

// Require raven for Sentry error logging
require_once 'vendor/sentry-php-master/lib/Raven/Autoloader.php';
Raven_Autoloader::register();

// Enable Sentry automatic error and exception capturing which is recomended
$client = new Raven_Client('https://[my-DNS-key-is-here]@app.getsentry.com/82094');
$error_handler = new Raven_ErrorHandler($client);
$error_handler->registerExceptionHandler();
$error_handler->registerErrorHandler();
$error_handler->registerShutdownFunction();


// Capture a message
$event_id = $client->getIdent($client->captureMessage('Try to send a message'));

 echo '<p>Sentry test 1</p>'; 

 // Create n error by looking for a file that isn't there 
 $file=fopen("welcome.txt","r");


 ?> 
 </body>
</html>

最佳答案

您是否尝试过运行 $client->install() 函数,您将使用它注册所有错误处理程序 Following pic is from Sentry documentation [1]

关于php - 使用 PHP 设置 Sentry ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37753174/

相关文章:

php - 使用新的 REST API 应用程序从经典(IPN 端点)搜索 Paypal 交易

php - 将 cURL 发布到 Zapier Webhook

kubernetes-helm - 无法在 Sentry 图表 values.yaml 中更改 Helm zookeeper 的存储类

php - 根据区号获取用户时区的最佳方法

php - MySQL时区比较

javascript - 大尺寸图像在 jcrop 中无法正确裁剪

docker - Sentry 通过 docker 安装 - 如何设置 https?

node.js - Sentry 不会向所需邮件抛出错误

docker - 如何使用 docker 设置 Sentry

java - 如何将用户信息添加到 Sentry 上下文?