Wells
Wells

Reputation: 10979

PHP & Xdebug: NOT writing stack to error log?

Dearest PHP folks, is there a way to make Xdebug show the entire stack on the screen but NOT write it to the error log? I'd only like the actual error line in the log file itself, but I'd like to see the stack on the screen.

Upvotes: 3

Views: 870

Answers (1)

greg0ire
greg0ire

Reputation: 23265

xdebug uses the error handler mechanism to display its stack trace. If you checkout xdebug sources, and look in xdebug.c , you'll see this on line 801:

      if (XG(default_enable) && zend_hash_find(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), "HTTP_SOAPACT     ION", 16, (void**)&dummy) == FAILURE) {
          zend_error_cb = new_error_cb;
          zend_throw_exception_hook = xdebug_throw_exception_hook;
      }

The xdebug_error_cb() (error callback) and xdebug_throw_exception_hook() functions are defined in another file, xdebug_stack.c , and do not seem to check any config settings to see whether the stack trace should be included in the log or not... so your only option is to rewrite these function in php, and set a new error handler with the set_error_handler() function. Good luck!

Upvotes: 3

Related Questions