-
Notifications
You must be signed in to change notification settings - Fork 194
Enable debugger logs
In a "launch" configuration only, you can enable debugger logs by setting "logToFile": true in the debug configuration in the launch.json for your work space. When using with the ms-python.python extension, the logs files will be stored in the extension root (Unix/Mac: ~/.vscode/extensions/ms-python.python-*; Windows: %USERPROFILE%\.vscode\extensions\ms-python.python-*)
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"logToFile": true,
}Set the DEBUGPY_LOG_DIR environment variable to enable debugger logs. Ensure that the path provided to DEBUGPY_LOG_DIR is a valid directory.
DEBUGPY_LOG_DIR=~/logsFor "launch" configurations, the variable needs to be set in the environment used by the debugger client. For example, for VSCode SSH remoting, it needs to be set on the remote machine.
For "attach" configurations, the variable needs to be set in the environment in which the debugged application is running.
For "attach" scenarios, another way to log is using the CLI. You can use --log-to to enable logging and provide a directory where logs should be stored.
python3 -m debugpy --listen 5678 --wait-for-client --log-to ~/logs myscript.py