• Resolved plaidpowered

    (@plaidpowered)


    I would really love the ability to see a back trace of an error’s origin. Sometimes an error is thrown on a WordPress core function because some function up the chain was the culprit, but it’s currently impossible to know where that is. So adding the output of debug_backtrace to the database log, or even if you could simply add an action to the Log_Handler->handle() function so I could add a trace myself, that would be super helpful. Thanks for considering it and for providing such a useful plugin!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter plaidpowered

    (@plaidpowered)

    Closing, because while looking for an alternative solution I discovered the extraordinary complexity of such a request and I wonder if it’s even possible. Nevermind!

    Plugin Author verygoodplugins

    (@verygoodplugins)

    @plaidpowered I went down that road too ??

    In the case of an *actual* fatal error, you will get a backtrace included automatically (it’s part of the message returned by error_get_last()). That’s because FEN is triggered directly as a result of the error.

    But for warnings and other stuff, calling debug_backtrace() doesn’t work since the error may have happened a long time ago.

    We looked into registering a custom error hander using set_error_handler() instead, but it can conflict with other plugins that are doing the same thing… and we couldn’t guarantee 100% reliability.

    So, that’s the way it is (for now). But if anyone finds a way to reliably get a backtrace for all error types I’d love to hear it ??

    Thread Starter plaidpowered

    (@plaidpowered)

    There’s long discussions on the PHP set_error_handler documentation comments about this, and at least one super long Stack Overflow thread, PHP simply doesn’t seem designed to provide the info we need unless Xdebug is installed. By the time the error gets to the error handler callback, the backtrace has already been lost. Makes it real fun to track down deprecation warnings in production…

    Thanks for replying, if someday I find a solution (probably won’t until the PHP function itself changes) I’ll be sure to let you know.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Back trace?’ is closed to new replies.