Skip to content

Add setting to enable Arduino CLI daemon debug output #1056

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
4 of 5 tasks
per1234 opened this issue Jun 13, 2022 · 6 comments · Fixed by #1065
Open
4 of 5 tasks

Add setting to enable Arduino CLI daemon debug output #1056

per1234 opened this issue Jun 13, 2022 · 6 comments · Fixed by #1065
Assignees
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@per1234
Copy link
Contributor

per1234 commented Jun 13, 2022

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:

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 tracker
  • I verified the feature was still missing when using the latest nightly build
  • My request contains all necessary details
@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Jun 13, 2022
@kittaakos
Copy link
Contributor

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.

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.

@kittaakos kittaakos self-assigned this Jun 13, 2022
@AlbyIanna
Copy link
Contributor

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
Copy link
Contributor

This isn't the first time we'd want to have some user preference

Do you remember the other use case?

If there is no need for a sophisticated settings support now, let's do the following:

  • Declare a preference,
  • Read the settings.json on the backend with EnvVariablesServer#getConfigDir (<-- this is ~/.arduinoIDE)

Thoughts?

@AlbyIanna
Copy link
Contributor

Do you remember the other use case?

I think it was something about authentication, but maybe @fstasi remembers it better.

If there is no need for a sophisticated settings support now, let's do the following:

Declare a preference,
Read the settings.json on the backend with EnvVariablesServer#getConfigDir (<-- this is ~/.arduinoIDE)
Thoughts?

yes, that's what I thought 👌

kittaakos pushed a commit that referenced this issue Jun 16, 2022
kittaakos pushed a commit to kittaakos/arduino-ide that referenced this issue Jun 16, 2022
@kittaakos kittaakos assigned AlbyIanna and unassigned kittaakos and AlbyIanna Jun 17, 2022
@AlbyIanna
Copy link
Contributor

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:

  • add a new setting called Debug log files path
  • when the Debug setting is enabled and Debug 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
Copy link
Contributor Author

per1234 commented 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.

@per1234 per1234 linked a pull request Jun 23, 2022 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants