Debugging Your PHP Cake Application

Debugging Your PHP Cake Application

Wherein I go over some common methods for getting data out of your application and into the hands of developers.

35ce1084ddd81008486fcc31170bec96?s=128

Jose Diaz-Gonzalez

September 02, 2012
Tweet

Transcript

  1. Debugging your PHP Cake Application Thursday, March 21, 13

  2. about n Developer and Operations at seatgeek.com n Cake Core

    - Plugins Site and IRC Troll n Open Source Contributor (github.com/josegonzalez) Thursday, March 21, 13
  3. Trace the Codepath Thursday, March 21, 13

  4. Thursday, March 21, 13

  5. Thursday, March 21, 13

  6. Thursday, March 21, 13

  7. DERP Thursday, March 21, 13

  8. packages/dl/1/@{* Thursday, March 21, 13

  9. packages/dl/1/@{* DERP Thursday, March 21, 13

  10. Thursday, March 21, 13

  11. Showing Context Thursday, March 21, 13

  12. debug($herp) /app/Controller/PackagesController.php (line 107) 'derp' Thursday, March 21, 13

  13. debug($herp) /app/Controller/PackagesController.php (line 107) 'derp' class name Thursday, March 21,

    13
  14. debug($herp) /app/Controller/PackagesController.php (line 107) 'derp' line number Thursday, March 21,

    13
  15. debug($herp) /app/Controller/PackagesController.php (line 107) 'derp' the good bits Thursday, March

    21, 13
  16. xdebug apt-get install php5-xdebug # php.ini [xdebug] xdebug.cli_color = 1

    Thursday, March 21, 13
  17. var_dump() Thursday, March 21, 13

  18. overrides var_dump var_dump() Thursday, March 21, 13

  19. type var_dump() Thursday, March 21, 13

  20. contents var_dump() Thursday, March 21, 13

  21. length var_dump() Thursday, March 21, 13

  22. xdebug_debug_zval() Thursday, March 21, 13

  23. tight loop goodies xdebug_debug_zval() Thursday, March 21, 13

  24. Don’t Break Production Thursday, March 21, 13

  25. debug(); die; Thursday, March 21, 13

  26. debug(); die; Thursday, March 21, 13

  27. diebug() Thursday, March 21, 13

  28. diebug() Thursday, March 21, 13

  29. Show Application State Thursday, March 21, 13

  30. git clone git://github.com/cakephp/debug_kit debug_kit Thursday, March 21, 13

  31. debug_kit Thursday, March 21, 13

  32. debug_kit Thursday, March 21, 13

  33. debug_kit Thursday, March 21, 13

  34. debug_kit Thursday, March 21, 13

  35. etc. Thursday, March 21, 13

  36. the server is part of the application Thursday, March 21,

    13
  37. SO TREAT IT AS SUCH Thursday, March 21, 13

  38. redis-live Thursday, March 21, 13

  39. paramedic Thursday, March 21, 13

  40. varnishstat Thursday, March 21, 13

  41. statistics are good Thursday, March 21, 13

  42. visualizations are Thursday, March 21, 13

  43. Notify on Errors Thursday, March 21, 13

  44. first pass Thursday, March 21, 13

  45. second pass Thursday, March 21, 13

  46. third pass Thursday, March 21, 13

  47. fourth pass Thursday, March 21, 13

  48. fifth pass? Thursday, March 21, 13

  49. Verbose Logging Thursday, March 21, 13

  50. printf Thursday, March 21, 13

  51. no timestamp printf Thursday, March 21, 13

  52. needs newlines printf Thursday, March 21, 13

  53. SUCKS printf Thursday, March 21, 13

  54. sgLogMessage Thursday, March 21, 13

  55. categorization sgLogMessage Thursday, March 21, 13

  56. auto-out with newlines sgLogMessage Thursday, March 21, 13

  57. standard date sgLogMessage Thursday, March 21, 13

  58. stored logs! sgLogMessage Thursday, March 21, 13

  59. logs can never be too VERBOSE Thursday, March 21, 13

  60. Unify Logging Thursday, March 21, 13

  61. log-aggregator message parser notification system logstash Thursday, March 21, 13

  62. logstash Thursday, March 21, 13

  63. logstash Thursday, March 21, 13

  64. n Searchable logs n Aggregate all logs in one place

    n Alert, Notify, Create metrics from one place n Empower your developers ¿logstash? Thursday, March 21, 13
  65. Aggregate Metrics Thursday, March 21, 13

  66. graphite time-series data graph rendering simple graph url-api Thursday, March

    21, 13
  67. graphite does not... alert on data collect data export data

    https://gist.github.com/3576242 Thursday, March 21, 13
  68. Statsd::increment(‘seatgeek.www.php.e_warning’); # sends data to statsd # metrics aggregated #

    view in your graphite backend sending stats Thursday, March 21, 13
  69. interesting usecases n check mysql replication length n track conversions

    in your app n expense tracking n alerting systems Thursday, March 21, 13
  70. earthquake effects Thursday, March 21, 13

  71. apc configuration Thursday, March 21, 13

  72. Questions? Thursday, March 21, 13