Description
Describe the request
Add an advanced setting (only accessible via the "Preferences: Open Settings (UI)" or "Preferences: Open Settings (JSON)" commands) which will enable debug logging of gRPC calls handled by the Arduino CLI daemon.
This setting would cause a --debug
or --debug-file
flag to be added to the arguments passed to Arduino CLI during the arduino-cli daemon
invocation on Arduino IDE startup.
🙂 This will provide visibility via the console of the exact gRPC operations that are performed, which can be very useful for troubleshooting certain issues, both to determine whether the source, and to determine the specific operations associated with the problem.
Describe the current behavior
The Arduino IDE 2.x code base is intended to be focused exclusively on the GUI of the IDE, while all the underlying operations (e.g., sketch dependencies management, compilation, uploads) is handled by separate tools, most notably Arduino CLI.
Users perceive any problem encountered when using Arduino IDE to be a defect in the IDE. In reality, the fault experienced in the Arduino IDE may only be the symptom of a bug in one of the other tools. The essential first step toward fixing that bug is to determine which project it lives in. Once that is done, development resources can be effectively allocated to investigation and resolution.
Communication between Arduino IDE 2.x and Arduino CLI is done via a gRPC interface. The Arduino IDE's logging output does not always provide a clear picture of the gRPC operations that are being performed by the Arduino IDE.
🙁 It is difficult (most especially for those without a deep familiarity of the internals of the Arduino IDE) to identify the true source of a problem which might be related to the gRPC operations.
TODOs:
- Enable
debug
for the CLI daemon, (Can enable debug logging of the gRPC calls. #1065)Enabledebug-file
for the CLI daemon.
Arduino IDE version
2.0.0-rc7
Operating system
All
Operating system version
N/A
Additional context
This is an advanced feature which will be used either by advanced users or by users who are guided in its usage by other advanced users.
For this reason, there is no need to put effort towards a polished user experience. It will be no problem if it is necessary to restart the Arduino IDE after adjusting the setting (ideally the setting description would state such a requirement though).
Issue checklist
- I searched for previous requests in the issue trackerI verified the feature was still missing when using the latest nightly buildMy request contains all necessary details
Activity
kittaakos commentedon Jun 13, 2022
It won't work; at least it's not that easy.
The frontend code defines the Theia settings. The CLI daemon is already up and running when there is a browser window, and the Theia settings are available from IDE2. We need to find a way where to put such a setting.
AlbyIanna commentedon Jun 13, 2022
This isn't the first time we'd want to have some user preference to be available in the backend, before the front-end is started. We surely don't want the CLI to wait for the front-end to start.
@kittaakos would it make sense to have some sort of "back-end" settings that are saved as a configuration file in the file system?
I'm pretty sure @per1234 would extremely like this config file even if it's not editable from the IDE UI.
kittaakos commentedon Jun 13, 2022
Do you remember the other use case?
If there is no need for a sophisticated settings support now, let's do the following:
settings.json
on the backend withEnvVariablesServer#getConfigDir
(<-- this is~/.arduinoIDE
)Thoughts?
AlbyIanna commentedon Jun 13, 2022
I think it was something about authentication, but maybe @fstasi remembers it better.
yes, that's what I thought 👌
Can enable debug logging of the gRPC calls.
Can enable debug logging of the gRPC calls.
AlbyIanna commentedon Jun 20, 2022
The
--debug-file
flag will make it possible to save the cli logs into a file.We could implement this in different ways, so let's first describe the exact behavior we want for the IDE.
My proposal is this:
Debug log files path
Debug
setting is enabled andDebug log files path
is populated, the IDE will run the cli with the following flag--debug-file "[VALUE_OF_DEBUG_LOG_FILES_PATH]/arduino-cli-log-[date in ISO8601].txt"
-[nice to have] to prevent the creation of infinite log files, keep only the last 10 log files (and delete older ones)
@kittaakos @per1234 thoughts?
per1234 commentedon Jun 20, 2022
@AlbyIanna I think it could be a useful addition. So far, I have preferred the combination of the normal logs + the additional output provided by
arduino-cli daemon --debug
. However, it might be that there could be times when only the latter is wanted and the former would only be additional "noise" in what is already a large amount of output.