I am developing a PHP application hosted on Apache installed through XAMPP 3.3, on Windows. I have the XDebug 3.x extension set up in VS Code and debugging works perfectly fine. My launch.json
entry looks like this:
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003
},
My Apache php.ini
looks like this:
[...]
error_log="C:\xampp\php\logs\php_error_log.log"
[...]
[XDebug]
zend_extension=xdebug
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.profiler_enable=0
xdebug.profiler_enable_trigger=0
xdebug.client_host=192.168.1.10
xdebug.client_port=9003
xdebug.log=C:\xampp\apache\logs\xdebug.log
xdebug.log_level=7
I see that xdebug.log
is successfully used by XDebug. I don't see any obvious error in this file.
In my PHP script, I can successfully create a log entry by using error_log('This is a log entry')
, and this string gets appended to php_error_log.log
, as expected.
However, I don't know how to have XDebug send over the log entries to the DEBUG CONSOLE
pane window in Visual Studio Code. Is it possible?
If you set your PHP error_log
setting to syslog
and PHP will send all error log messages to stderr, which Xdebug will then send to the IDE.
Xdebug itself does not send error_log
messages to the IDE, but there is now an xdebug_notify()
function, with which you can send messages (strings, and variables) to the IDE as well.