Skip to content

Latest commit

 

History

History
45 lines (33 loc) · 1.21 KB

File metadata and controls

45 lines (33 loc) · 1.21 KB

← Error Handling | Debugging(中文) | SDK Integration →


Debugging

The PHP SDK supports Guzzle wire debug output.

<?php
require_once(__DIR__ . '/vendor/autoload.php');

$config = \Volcengine\Common\Configuration::getDefaultConfiguration()
    ->setAk("Your ak")
    ->setSk("Your sk")
    ->setRegion('cn-beijing')
    ->setDebug(true)
    ->setDebugFile('/tmp/volcengine-php-sdk-debug.log');

SDK structured debug logs can be enabled separately with a bitmask. HTTP request and response logs do not record request or response body.

<?php
$config->setLogLevel(
    \Volcengine\Common\SdkLogger::LOG_REQUEST |
    \Volcengine\Common\SdkLogger::LOG_RESPONSE |
    \Volcengine\Common\SdkLogger::LOG_RETRY |
    \Volcengine\Common\SdkLogger::LOG_ENDPOINT
);

You can append your application identifier to the SDK User-Agent. The SDK User-Agent remains the prefix:

<?php
$config->setUserAgent('my-app/1.0');

You can still use Configuration::toDebugReport() for environment diagnostics.


← Error Handling | Debugging(中文) | SDK Integration →