Search code examples
phploggingxdebugxdebug-3

PHP error log spammed by Xdebug Time-out messages


The step-debugger is working fine, no issues there.

Each time I'm working in VS code without listening to any incoming connections from xdebug, PHP writes this message to my logs when I refresh my page:

[06-Sep-2021 13:39:58 Europe/Brussels] Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: 10.1.2.4:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(

Since I don't like deleting hundreds of irrelevant messages from my logs, I'm wondering if I can disable this particular message? I couldn't really find anything in the docs about this.

Overwriting the behavior using set_error_handler would be an option, but I'd like to keep it clean :)


Solution

  • You can't do that for this message in Xdebug 3.0.

    But in Xdebug 3.1 (beta1 to be released within the hour) you can set Xdebug's xdebug.log to a writable file (or perhaps even /dev/null, I haven't tried that). If an Xdebug log is active, then Xdebug will not direct these time-out messages to PHP's error mechanism any more, and hence they won't show up in the log.

    This is the related issue: https://bugs.xdebug.org/view.php?id=1948

    FWIW, you won't likely be able to use set_error_handler to do something here, as it's an internal Xdebug call that doesn't go through the PHP error mechanism.