XDEBUG Disable Step Debugger
Hi Jürgen,
I have a small concern regarding XDebug that I cannot solve, but which may also be important for other l3d users in the future. Hence the ticket. Note: Its nothing about functionallity. Everything works fine as intended.
Problem presentation based on debugging a drush command:
If I want to debug a drush command via the console (not in Php storm), the CLI outputs the output step by step. Is it possible to deactivate this somewhere? The documentation shows that step debugging is activated by this ENV var:
PHP_XDEBUG_MODE: debug
So my approach was to edit the docker-compose.yml smth like this: (I tried it with various variables which i took out of the official Documentation: https://xdebug.org/docs/all_settings, the following snippet is just for showcase purpose)
XDEBUG_CONFIG: "remote_enable=1 remote_host=127.0.0.1 remote_port=9003 idekey=PHPSTORM remote_autostart=1 remote_connect_back=On"
Use case: As a Drupal developer I debug quite frequently via the CLI. The output will be displayed via PHP Storm etc etc. So the actual debugging takes place in PHP Storm, but the command for this is entered in the development workflow via a console outside of PHP-Storm. As a result, one need CLI debugging, but the messages in the console (Step-Debuging) is obsolete.
Example drush command wsc:
What I want: (dont wonder its out of the drupal vm therefore xdrush command)
Question: Do you know of a way how this output of the step debugging can be deactivated and CLI debuging remains activated?
I know its an edge case but this is my task.
I looked already into the official documentation: https://xdebug.org/docs/step_debug
Also I looked into various forums like these:
https://newbedev.com/xdebug-disable-step-debug-time-out-connecting-to-debugging-client-waited-200-ms-tried-localhost-9003-through-xdebug-client-host-xdebug-client-port-code-example
https://ddev.readthedocs.io/en/v1.5.9/users/step-debugging/
Basically thats it. There is no more to find in the www. I am either to stupid or cant search right. Would be loveley if you can help me out if you see some benefit for future users.
- Show closed items
Activity
-
Newest first Oldest first
-
Show all activity Show comments only Show history only
- Owner
I can't reproduce that. We don't see such a problem. If we turn on xdebug, the docker-compose php-service gets these extra environment variables:
PHP_XDEBUG: 1 PHP_XDEBUG_MAX_NESTING_LEVEL: 512 PHP_XDEBUG_MODE: debug PHP_XDEBUG_REMOTE_HOST: 172.17.0.1 PHP_XDEBUG_START_WITH_REQUEST: 1 PHP_IDE_CONFIG: serverName=Docker DRUSH_ALLOW_XDEBUG: 1
That's all we do. And then we can still run drush as before and we don't get any extra output on the command line.
I have same the symptoms. According to https://xdebug.org/docs/install#log_level its possible to set another log level.
I set PHP_XDEBUG_LOG_LEVEL: 1, and made
a d4d up
, works. Afterwards I changed to debug-mode using:a debug on
, now the setting is back to default.How can we set that log_level as default?
- Owner
What exactly is the error? I can't watch quickly enough to get all the details from that fancy animated gif above.
xxx@l3dnov-l3d:/drupal (branch: master!) $ drush status [105] Log opened at 2021-11-17 09:36:32.835542 [105] [Step Debug] INFO: Connecting to configured address/port: 172.17.0.1:9003. [105] [Step Debug] INFO: Connected to debugging client: 172.17.0.1:9003 (through xdebug.client_host/xdebug.client_port). :-) [105] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///usr/local/bin/drush" language="PHP" xdebug:language_version="7.4.21" protocol_version="1.0" appid="105"><engine version="3.0.4"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2021 by Derick Rethans]]></copyright></init> [105] [Step Debug] <- feature_set -i 1 -n show_hidden -v 1 [105] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="show_hidden" success="1"></response> [105] [Step Debug] <- feature_set -i 2 -n max_depth -v 1 [105] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="max_depth" success="1"></response> [105] [Step Debug] <- feature_set -i 3 -n max_children -v 100 [105] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="max_children" success="1"></response> [105] [Step Debug] <- feature_set -i 4 -n extended_properties -v 1 [105] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" feature="extended_properties" success="1"></response> [105] [Step Debug] <- feature_set -i 5 -n notify_ok -v 1 [105] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="5" feature="notify_ok" success="1"></response>
we try to disable those debug-infos in terminal if debug-mode is on.
- Owner
Very strange, we don't get any of that anywhere. Could you upload your docker-compose.yml, please? Maybe we can see something there.
php: image: 'wodby/drupal-php:7.4' environment: PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025 DB_HOST: mariadb DB_USER: drupal DB_PASSWORD: drupal DB_NAME: drupal DB_DRIVER: mysql COMPOSER_ALLOW_SUPERUSER: 1 PHP_XDEBUG: 1 PHP_XDEBUG_MAX_NESTING_LEVEL: 512 PHP_XDEBUG_MODE: debug PHP_XDEBUG_REMOTE_HOST: 172.17.0.1 PHP_XDEBUG_START_WITH_REQUEST: 1 PHP_IDE_CONFIG: serverName=Docker DRUSH_ALLOW_XDEBUG: 1 SSH_AUTH_SOCK: /ssh-agent volumes: - /var/www/l3d-nov:/var/www/html - /var/www/l3d-nov/drush:/etc/drush - /tmp/ssh-FcIaBu7xaZMV/agent.4621:/ssh-agent extra_hosts: - 'l3dnov.docker.localhost:172.17.0.1'
- Owner
Same here, still we don't see any output.
Could you go into the PHP container with
a d4d shell
and executephp -i |grep -i xdebug
and paste the xdebug settings here? - Author
/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini, with Xdebug v3.0.4, Copyright (c) 2002-2021, by Derick Rethans xdebug Support Xdebug on Patreon, GitHub, or as a business: https://xdebug.org/support Enabled Features<br/>(through 'xdebug.mode' setting) xdebug.auto_trace => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3) xdebug.cli_color => 0 => 0 xdebug.client_discovery_header => no value => no value xdebug.client_host => 172.17.0.1 => 172.17.0.1 xdebug.client_port => 9003 => 9003 xdebug.cloud_id => no value => no value xdebug.collect_assignments => Off => Off xdebug.collect_includes => (setting removed in Xdebug 3) => (setting removed in Xdebug 3) xdebug.collect_params => (setting removed in Xdebug 3) => (setting removed in Xdebug 3) xdebug.collect_return => Off => Off xdebug.collect_vars => (setting removed in Xdebug 3) => (setting removed in Xdebug 3) xdebug.connect_timeout_ms => 200 => 200 xdebug.coverage_enable => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3) xdebug.default_enable => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3) xdebug.discover_client_host => Off => Off xdebug.dump.COOKIE => no value => no value xdebug.dump.ENV => no value => no value xdebug.dump.FILES => no value => no value xdebug.dump.GET => no value => no value xdebug.dump.POST => no value => no value xdebug.dump.REQUEST => no value => no value xdebug.dump.SERVER => no value => no value xdebug.dump.SESSION => no value => no value xdebug.dump_globals => On => On xdebug.dump_once => On => On xdebug.dump_undefined => Off => Off xdebug.file_link_format => no value => no value xdebug.filename_format => no value => no value xdebug.force_display_errors => Off => Off xdebug.force_error_reporting => 0 => 0 xdebug.gc_stats_enable => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3) xdebug.gc_stats_output_dir => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3) xdebug.gc_stats_output_name => gcstats.%p => gcstats.%p xdebug.halt_level => 0 => 0 xdebug.idekey => no value => no value xdebug.log => /proc/self/fd/2 => /proc/self/fd/2 xdebug.log_level => 7 => 7 xdebug.max_nesting_level => 512 => 512 xdebug.max_stack_frames => -1 => -1 xdebug.mode => debug => debug xdebug.output_dir => /mnt/files/xdebug => /mnt/files/xdebug xdebug.overload_var_dump => (setting removed in Xdebug 3) => (setting removed in Xdebug 3) xdebug.profiler_append => Off => Off xdebug.profiler_enable => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3) xdebug.profiler_enable_trigger => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3) xdebug.profiler_enable_trigger_value => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3) xdebug.profiler_output_dir => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3) xdebug.profiler_output_name => cachegrind.out.%p => cachegrind.out.%p xdebug.remote_autostart => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3) xdebug.remote_connect_back => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3) xdebug.remote_enable => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3) xdebug.remote_host => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3) xdebug.remote_log => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3) xdebug.remote_log_level => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3) xdebug.remote_mode => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3) xdebug.remote_port => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3) xdebug.remote_timeout => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3) xdebug.scream => Off => Off xdebug.show_error_trace => Off => Off xdebug.show_exception_trace => Off => Off xdebug.show_local_vars => Off => Off xdebug.show_mem_delta => (setting removed in Xdebug 3) => (setting removed in Xdebug 3) xdebug.start_upon_error => default => default xdebug.start_with_request => yes => yes xdebug.trace_enable_trigger => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3) xdebug.trace_enable_trigger_value => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3) xdebug.trace_format => 0 => 0 xdebug.trace_options => 0 => 0 xdebug.trace_output_dir => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3) xdebug.trace_output_name => trace.%c => trace.%c xdebug.trigger_value => no value => no value xdebug.var_display_max_children => 128 => 128 xdebug.var_display_max_data => 512 => 512 xdebug.var_display_max_depth => 3 => 3 PHP_XDEBUG_REMOTE_HOST => 172.17.0.1 DRUSH_ALLOW_XDEBUG => 1 PHP_XDEBUG_MODE => debug PHP_XDEBUG_START_WITH_REQUEST => 1 PHP_XDEBUG => 1 PHP_XDEBUG_MAX_NESTING_LEVEL => 512 $_SERVER['PHP_XDEBUG_REMOTE_HOST'] => 172.17.0.1 $_SERVER['DRUSH_ALLOW_XDEBUG'] => 1 $_SERVER['PHP_XDEBUG_MODE'] => debug $_SERVER['PHP_XDEBUG_START_WITH_REQUEST'] => 1 $_SERVER['PHP_XDEBUG'] => 1 $_SERVER['PHP_XDEBUG_MAX_NESTING_LEVEL'] => 512
- Owner
Ahh, the setting
xdebug.log => /proc/self/fd/2 => /proc/self/fd/2
gets the debugger to output to the pipe 2 of the current process. That's pretty sure the reason for that. However, where is that coming from? It's not set by L3D or Docker4Drupal. Is that maybe an environment variable set somewhere on your hosts? Or any other idea where that could be coming from? - Author
So I searched my whole system to find where that var is set but didnt found anything.
In the meantime i set following env var in the docker-compose.yml under the php service:
PHP_XDEBUG_LOG_LEVEL: 1
afterwards typeda d4d up
And now there is no console message anymore > fine.BUT as you know when I disable debug and enable it again the env var is gone. So is there a way if we can set either the default value to
PHP_XDEBUG_LOG_LEVEL: 1
OR A sustainable way of editing env vars in the docker-compose file so they are present after ahoy command?What would you suggest?
- Owner
I would be worried, if some settings are not explainable. And I would want to solve the real issue.
If you wanted to ignore the issue and just use the environment variable as a workaround, you will find the solution in the documentation under https://devops-tools.docs.lakedrops.com/composer/plugin/d4d/#adding-new-docker-services-or-enhancing-existing-ones
- Author
Thank you for your input!
- Nils Traut closed
closed
- Maintainer
My entry is set to;
xdebug.log => /proc/self/fd/2 => /proc/self/fd/2
My env on my host:
COLORTERM=truecolor DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.path DESKTOP_SESSION=ubuntu DISPLAY=:0 GDMSESSION=ubuntu GJS_DEBUG_OUTPUT=stderr GJS_DEBUG_TOPICS=JS ERROR;JS LOG GNOME_DESKTOP_SESSION_ID=this-is-deprecated GNOME_SHELL_SESSION_MODE=ubuntu GNOME_TERMINAL_SCREEN=/org/gnome/Terminal/screen/c48c2840_0f55_497b_a213_651513f21f76 GNOME_TERMINAL_SERVICE=:1.157 GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1 GTK_MODULES=gail:atk-bridge HOME=/home/danielspeicher IM_CONFIG_PHASE=1 INVOCATION_ID=808b6af335fe433b8fb5126d61843489 JOURNAL_STREAM=8:46997 LANG=de_DE.UTF-8 LOGNAME=danielspeicher MANAGERPID=2575 MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin PWD=/home/danielspeicher QT_ACCESSIBILITY=1 QT_IM_MODULE=ibus SESSION_MANAGER=local/atticlin02:@/tmp/.ICE-unix/2805,unix/atticlin02:/tmp/.ICE-unix/2805 SHELL=/usr/bin/fish SHLVL=1 SSH_AGENT_PID=2762 SSH_AUTH_SOCK=/run/user/1000/keyring/ssh TERM=xterm-256color USER=danielspeicher USERNAME=danielspeicher VTE_VERSION=6003 WINDOWPATH=2 XAUTHORITY=/run/user/1000/gdm/Xauthority XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg XDG_CURRENT_DESKTOP=ubuntu:GNOME XDG_DATA_DIRS=/usr/share/ubuntu:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop XDG_MENU_PREFIX=gnome- XDG_RUNTIME_DIR=/run/user/1000 XDG_SESSION_CLASS=user XDG_SESSION_DESKTOP=ubuntu XDG_SESSION_TYPE=x11 XMODIFIERS=@im=ibus
@jurgenhaas Might there be a setting on your host, that sets the entry to
xdebug.log => no value => no value
?My host was setup a few days ago and there is no
php
orxdebug
installed. Just the tools, that makel3d
work. - danielspeicher reopened
reopened
- Maintainer
I also found an entry in in the php docker container:
./etc/gotpl/docker-php-ext-xdebug.ini.tmpl:xdebug.log = {{ getenv "PHP_XDEBUG_LOG" "/proc/self/fd/2" }}
- Maintainer
These are my
env
in thephp
container concerning XDEBUG:bash-5.1# env | grep 'XDEBUG' PHP_XDEBUG_REMOTE_HOST=172.17.0.1 DRUSH_ALLOW_XDEBUG=1 PHP_XDEBUG_MODE=debug PHP_XDEBUG_START_WITH_REQUEST=1 PHP_XDEBUG=1 PHP_XDEBUG_MAX_NESTING_LEVEL=512
The env PHP_XDEBUG_LOG is not set, so I assume the function
getenv
takes the default, which is set toproc/self/fd/2
- jurgenhaas assigned to @jurgenhaas
assigned to @jurgenhaas
- Owner
My env variables are exactly the same as yours. So I have still no idea, where the difference in
php -i
forxdebug.log
is coming from.However, we could be explicit about that setting. Please add
PHP_XDEBUG_LOG: ''
to the PHP env variables in your docker-compose.json and then runa d4d up
to recreate the php container and see if that fixes it. If not, you could also tryPHP_XDEBUG_LOG: '/dev/null'
instead.