Qt WebEngine Debugging and Profiling
js logging category. However, only warning and fatal messages are printed by default. To change this, you either have to set custom rules for the
All messages can also be accessed through the Qt WebEngine developer tools.
The Qt WebEngine module provides web developer tools that make it easy to inspect and debug layout and performance issues of any web content.
The developer tools are accessed as a local web page using a Chromium or Qt WebEngine based browser, such as the Chrome browser.
To activate the developer tools, start an application that uses Qt WebEngine with the command-line argument
<port_number> refers to a local network port. The web developer tools can then be accessed by launching a browser at the address
Alternatively, the environment variable QTWEBENGINE_REMOTE_DEBUGGING can be set. It can be set as either just a port working similarly to
--remote-debugging-port or given both a host address and a port. The latter can be used to control which network interface to export the interface on, so that you can access the developer tools from a remote device.
To avoid WebSocket errors during remote debugging, add an additional command-line argument
--remote-allow-origins=<origin>[,<origin>, ...], where
<origin> refers to the request origin. Use
--remote-allow-origins=* to allow connections from all origins. If nothing is specified, Qt WebEngine will add
--remote-allow-origins=* to command-line arguments when remote-debugging is enabled, thereby allowing requests from all origins.
For a detailed explanation of the capabilities of developer tools, see the Chrome DevTools page.
You can use the following command-line arguments while debugging to provide input for bug reports:
--disable-gpudisables GPU hardware acceleration. This is useful when diagnosing OpenGL problems.
--disable-loggingdisables console logging, which might be useful for debug builds.
--enable-logging --log-level=0enables console logging and sets the logging level to 0, which means that messages of the severity
infoand above are recorded in the log. This is the default for debug builds. Other possible log levels are
2for errors, and
3for fatal errors.
--v=1Increases the logging level beyond what
--log-levelcan, and enables logging debug messages up to verbosity level
1. A higher number further increases verbosity, but may result in a large number of logged messages. Default is
0(no debug messages).
--no-sandboxdisables the sandbox for the renderer and plugin processes. Keep in mind that disabling the sandbox might present a security risk.
--single-processruns the renderer and plugins in the same process as the browser. This is useful for getting stack traces for renderer crashes.
--enable-features=NetworkServiceInProcessruns networking in the main process. This may help firewall management, since only the application executable will need to be whitelisted and not QtWebEngineProcess. It means losing the security of sandboxing of the network service though.
Alternatively, the environment variable QTWEBENGINE_CHROMIUM_FLAGS can be set. For example, the following value could be set to disable logging while debugging an application called mybrowser:
QTWEBENGINE_CHROMIUM_FLAGS can also be set using
qputenv from within the application if called before QtWebEngineQuick::initialize().
For dumping the WebEngineContext information, you can set the
QT_LOGGING_RULES environment variable to
The output contains information about the graphical backend, and the way how Qt WebEngine is initialized for the application. This is particularly useful for reproducing issues.
© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.