Skip to content

Add setting to enable Arduino CLI daemon debug output #1056

Open
@per1234

Description

@per1234

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)
    Enable debug-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 tracker
    I verified the feature was still missing when using the latest nightly build
    My request contains all necessary details

Activity

kittaakos

kittaakos commented on Jun 13, 2022

@kittaakos
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.

self-assigned this
on Jun 13, 2022
AlbyIanna

AlbyIanna commented on Jun 13, 2022

@AlbyIanna
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

kittaakos commented on Jun 13, 2022

@kittaakos
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

AlbyIanna commented on Jun 13, 2022

@AlbyIanna
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 👌

added a commit that references this issue on Jun 16, 2022
c84c58c
added a commit that references this issue on Jun 16, 2022
e2b3bae
AlbyIanna

AlbyIanna commented on Jun 20, 2022

@AlbyIanna
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

per1234 commented on Jun 20, 2022

@per1234
ContributorAuthor

@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.

linked a pull request that will close this issueCan enable debug logging of the gRPC calls. #1065on Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

topic: codeRelated to content of the project itselftype: enhancementProposed improvement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Participants

    @kittaakos@AlbyIanna@per1234

    Issue actions

      Add setting to enable Arduino CLI daemon debug output · Issue #1056 · arduino/arduino-ide