Recently I’ve been working on AWS PHP SDK. I found out that there is a simple code snippet to enable wire logging in the API
use Guzzle\Plugin\Log\LogPlugin; // Create an Amazon S3 client $s3Client = S3Client::factory(); // Add a debug log plugin $s3Client->addSubscriber(LogPlugin::getDebugPlugin());
However according to FAQs on the AWS docs site, we have to create our own plugin for logging in a file. I had a look at the code and found that you just have to provide the 2nd parameter to getDebugPlugin function and it wil start logging in the file
// Create an Amazon S3 client $s3Client = S3Client::factory(); $logPlugin = LogPlugin::getDebugPlugin(TRUE, //Don't provide this parameter to show the log in PHP output fopen(APPPATH . 'logs/wire.log', 'a') ); $client->addSubscriber($logPlugin);
Later if you want to stop the logging you have to use the following snippet.
//Remove this log plugin to the client $client->getEventDispatcher()->removeSubscriber($logPlugin);