debugging server service code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • liketofindoutwhy@gmail.com

    #1

    debugging server service code

    usually it is handy to debug PHP programs using print_r() or
    var_dump(), as they can print out all the variables you need and the
    web browser can show any run time error message. But what if it is
    the situation when the php file is providing info to the Javascript
    either as an AJAX call or even more so, as an OpenSocial's service --
    in those case, there is a bunch of parameters provided to the PHP file
    and it is really hard to mimic a session using
    http://www.oursite.com/getData.php?a...ken=3424242345... with
    possible data posted to the PHP file.

    In those situation, we can write any variable to a file using
    var_export() and a write function as a debug log... but what if there
    is any run time error... is there a way to redirect all those info
    also to a file, or somehow be able to see the run time error and stack
    trace?

    Any possible solution? Thanks for your help!

  • Jerry Stuckle

    #2
    Re: debugging server service code

    liketofindoutwh y@gmail.com wrote:
    usually it is handy to debug PHP programs using print_r() or
    var_dump(), as they can print out all the variables you need and the
    web browser can show any run time error message. But what if it is
    the situation when the php file is providing info to the Javascript
    either as an AJAX call or even more so, as an OpenSocial's service --
    in those case, there is a bunch of parameters provided to the PHP file
    and it is really hard to mimic a session using
    http://www.oursite.com/getData.php?a...ken=3424242345... with
    possible data posted to the PHP file.
    >
    In those situation, we can write any variable to a file using
    var_export() and a write function as a debug log... but what if there
    is any run time error... is there a way to redirect all those info
    also to a file, or somehow be able to see the run time error and stack
    trace?
    >
    Any possible solution? Thanks for your help!
    >
    >
    You can set a log file in your php.ini file which will log php-detected
    errors instead of displaying them.

    I have it on on my development system, just so I can go back and look at
    the errors if I need to. I just clean it up every few days (I make LOTS
    of typing errors :-)= ).

    It's also a good idea to have it on your production system and check it
    on a regular basis to ensure there are no unexpected errors. I
    generally have a cron job check the size and mail it to me of non-zero
    on a daily basis, then rotate it with the rest of the log files.

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • Paul Lautman

      #3
      Re: debugging server service code

      liketofindoutwh y@gmail.com wrote:
      usually it is handy to debug PHP programs using print_r() or
      var_dump(), as they can print out all the variables you need and the
      web browser can show any run time error message. But what if it is
      the situation when the php file is providing info to the Javascript
      either as an AJAX call or even more so, as an OpenSocial's service --
      in those case, there is a bunch of parameters provided to the PHP file
      and it is really hard to mimic a session using
      http://www.oursite.com/getData.php?a...ken=3424242345... with
      possible data posted to the PHP file.
      >
      In those situation, we can write any variable to a file using
      var_export() and a write function as a debug log... but what if there
      is any run time error... is there a way to redirect all those info
      also to a file, or somehow be able to see the run time error and stack
      trace?
      >
      Any possible solution? Thanks for your help!
      Further to Jerry's suggestions, you can also setup your own error handler
      using
      set_error_handl er()


      Comment

      Working...