GoogleCloudPlatform/google-cloud-php-debugger

Name: google-cloud-php-debugger

Owner: Google Cloud Platform

Description: null

Created: 2017-05-17 23:23:14.0

Updated: 2018-04-30 21:21:59.0

Pushed: 2018-04-30 21:21:58.0

Homepage: null

Size: 181

Language: PHP

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Google PHP Stackdriver Debugger

Idiomatic PHP client for Stackdriver Debugger.

NOTE: This repository is part of Google Cloud PHP. Any support requests, bug reports, or development contributions should be directed to that project.

Installation
  1. Install the PHP extension from PECL.

    cl install stackdriver_debugger-alpha
    

    On Windows, you can download pre-built .dll files from PECL.

    You may also need to enable the extension in your php.ini file:

     Unix
    nsion=stackdriver_debugger.so
    
     Windows
    nsion=php_stackdriver_debugger.dll
    
  2. Install with composer or add to your composer.json.

    mposer require google/cloud-debugger
    
  3. Run the batch daemon script in the background.

    On Unix-based systems that have semaphore extensions installed, run the BatchDaemon:

    ndor/bin/google-cloud-batch daemon
    

    On Windows or systems that do not have semaphore extensions installed, run the Debugger Daemon:

    ndor/bin/google-cloud-debugger -s <SOURCE_ROOT>
    

    The SOURCE_ROOT is the base location of your deployed application.

    Alternatively, you can provide a configuration script:

    ndor/bin/google-cloud-debugger -c <CONFIG_FILE>
    
  4. Include and start the debugger Agent as the first action in your application:

    nt = new Google\Cloud\Debugger\Agent();
    

    If this file is not in your source root, you will need to provide the path to your application's source root as an optional parameter:

    nt = new Google\Cloud\Debugger\Agent([
    'sourceRoot' => '/path/to/source/root'
    
    
Configuration
Snapshots

Debugger snapshots allow you to capture and inspect the call stack and local variables in your application without stopping or slowing it down. In general, you will set breakpoints via the Stackdriver Debugger UI in the Cloud Platform Console.

See Using Debug Snapshots for more information on snapshots.

Logpoints

Debugger logpoints allow you to inject logging into running services without restarting or interfering with the normal function of the service. This can be useful for debugging production issues without having to add log statements and redeploy.

By default, we will send all log messages to Stackdriver Logging, but you can customize this by providing any PSR-3 compatible logger. For example, to use monolog:

nt = new Google\Cloud\Debugger\Agent([
'logger' => new Monolog\Logger('name')

See Using Debug Logpoints for more information on logpoints.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.