Use databricks CLI log-file option to capture the logs#923
Conversation
The CLI can write its logs to a file and we don't have to manage this on the extension side
kartikgupta-db
left a comment
There was a problem hiding this comment.
LGTM. Thanks! Just some nits.
We also need to inform @PaulCornellDB to get our docs updated to say we do not support this configuration going forward.
| ); | ||
|
|
||
| const syncCommand = `${cliPath} sync . /Repos/[email protected]/project --watch --output json`; | ||
| const loggingArgs = `--log-level debug --log-file ${logFilePath} --log-format json`; |
There was a problem hiding this comment.
You can set these via environment variables. Then you don't need to worry about paths with spaces, etc.
There was a problem hiding this comment.
I went with the arguments for the consistency sake, as we use them for all other CLI options (including paths for sync destination, which can also contain spaces). As I understand paths with spaces shouldn't be a concern, as nodejs handles normalization for us, plus we don't spawn the process in a shell, so normalising shouldn't be necessary. I haven't tested this on Windows though, will try to double check
There was a problem hiding this comment.
Understood, I didn't see the array in loggingArguments and thought the args were built through string interpolation. Would be great to double check that everything works on Windows.
## Changes This will help differentiate multiple cli commands that write to the same log file. Noticed that the root module wasn't using the common log utilities, refactored it to avoid missing log arguments. Relevant PR on the databricks vscode extension side: databricks/databricks-vscode#923 ## Tests Tested manually for sdk and cli loggers
## packages/databricks-vscode ## <small>1.2.3 (2023-11-06)</small> * Make configuration wizard sticky (#925) ([7a4fb31](7a4fb31)), closes [#925](#925) * Refactor `StateStore` to make keys more explicit at the point of use. (#913) ([5b8fb23](5b8fb23)), closes [#913](#913) * Use databricks CLI log-file option to capture the logs (#923) ([18283bb](18283bb)), closes [#923](#923) ## packages/databricks-vscode-types ## <small>1.2.3 (2023-11-06)</small> --------- Co-authored-by: releasebot <[email protected]> Co-authored-by: Kartik Gupta <[email protected]> Co-authored-by: kartikgupta-db <[email protected]>

Changes
The CLI can write its logs to a file and we don't have to manage this on the extension side.
Tests
Updated existing tests