故障排除
PHP 的故障排除步骤
调试 SDK 问题的一个好方法是使用 logger
选项。为了您的方便,SDK 提供了两种实现方式,DebugFileLogger
和 DebugStdOutLogger
。
Copied
\Sentry\init([
'logger' => new \Sentry\Logger\DebugFileLogger('/path/to/your/logfile.log'),
]);
// or
\Sentry\init([
'logger' => new \Sentry\Logger\DebugStdOutLogger(),
]);
生成的输出看起来会是这样的:
Copied
sentry/sentry: [debug] The "Sentry\Integration\ExceptionListenerIntegration, Sentry\Integration\ErrorListenerIntegration, Sentry\Integration\FatalErrorListenerIntegration, Sentry\Integration\RequestIntegration, Sentry\Integration\TransactionIntegration, Sentry\Integration\FrameContextifierIntegration, Sentry\Integration\EnvironmentIntegration, Sentry\Integration\ModulesIntegration" integration(s) have been installed.
sentry/sentry: [info] Transaction [e2919a7b0f954478b6994c7282b060de] was started and sampled, decided by config:traces_sample_rate.
sentry/sentry: [info] Transaction [e2919a7b0f954478b6994c7282b060de] started profiling because it was sampled.
sentry/sentry: [info] Sending transaction [59390dc9dd934c0290d8cdc7a589da82] to o1.ingest.sentry.io [project:1].
sentry/sentry: [warning] The profile does not contain enough samples, the profile will be discarded.
sentry/sentry: [info] Sent transaction [59390dc9dd934c0290d8cdc7a589da82] to o1.ingest.sentry.io [project:1]. Result: "success" (status: 200).
这是由 PHP 配置引起的。PHP 7.4 引入了一个新的 .ini 设置 zend.exception_ignore_args
,该设置会忽略堆栈跟踪参数。检查您的 .ini 文件,确保此设置设置为 Off
或 0
。