際際滷

際際滷Share a Scribd company logo
Debugging your PHP
 Cake Application
about
n?   Developer and Operations at
     seatgeek.com

n?   Cake Core - Plugins Site and IRC Troll

n?   Open Source Contributor (github.com/
     josegonzalez)
Trace the
Debugging Your PHP Cake Application
Debugging Your PHP Cake Application
Debugging Your PHP Cake Application
DERP
packages/dl/1/
DERP



packages/dl/1/
Debugging Your PHP Cake Application
Showing Context
debug($herp)

/app/Controller/PackagesController.php (line 107)
                     'derp'
debug($herp)

/app/Controller/PackagesController.php (line 107)
                     'derp'




                            class name
debug($herp)

/app/Controller/PackagesController.php (line 107)
                     'derp'




                           line number
debug($herp)

/app/Controller/PackagesController.php (line 107)
                     'derp'




                        the good bits
xdebug
apt-get install php5-xdebug
          # php.ini
          [xdebug]
    xdebug.cli_color = 1
var_dump()
overrides   var_dump()
var_dump
var_dump()




type
var_dump()




contents
var_dump()




length
xdebug_debug_zval
xdebug_debug_zval




tight loop goodies
Don¨t Break
Production
debug(); die;
debug(); die;
diebug()
diebug()
Show Application
     State
debug_kit

git clone git://github.com/cakephp/debug_kit
debug_kit
debug_kit
debug_kit
debug_kit
etc.
the server is part of
  the application
SO TREAT IT AS
    SUCH
redis-live
paramedic
varnishstat
statistics are
    good
visualization
    are
Notify on Errors
?rst pass
second pass
third pass
fourth pass
?fth pass?
Verbose Logging
printf
printf




no timestamp
printf




needs newlines
printf




SUCKS
sgLogMessage
sgLogMessage




categorization
sgLogMessage




auto-out with
  newlines
sgLogMessage




standard date
sgLogMessage




stored logs!
logs can never be
  too VERBOSE
Unify Logging
logstash

 log-aggregator
 message parser
noti?cation system
logstash
logstash
?logstash?
n?   Searchable logs

n?   Aggregate all logs in one place

n?   Alert, Notify, Create metrics from one
     place

n?   Empower your developers
Aggregate Metrics
graphite

 time-series data
 graph rendering
simple graph url-
graphite does not...

alert on data
 collect data
export data


      https://gist.github.com/
sending stats

Statsd::increment(`seatgeek.www.php.e_warning¨);
# sends data to statsd
# metrics aggregated
# view in your graphite backend
interesting
n?   check mysql replication length

n?   track conversions in your app

n?   expense tracking

n?   alerting systems
earthquake effects
apc con?guration
Questions?

More Related Content

Debugging Your PHP Cake Application

Editor's Notes