-
Notifications
You must be signed in to change notification settings - Fork 744
refactor(ec2): pass log level to connect script #6161
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
Conversation
|
| STREAM_URL: session.StreamUrl, | ||
| SESSION_ID: session.SessionId, | ||
| TOKEN: session.TokenValue, | ||
| LOG_LEVEL: globals.logOutputChannel.logLevel, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like getLogger doesn't have e.g. getLogLevel. otoh, we could make the flag a simple boolean like LOG_DEBUG:
| LOG_LEVEL: globals.logOutputChannel.logLevel, | |
| LOG_DEBUG: getLogger().logLevelEnabled('debug') ? '1': '0', |
that also would avoid the use of -le in the bash script
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think logLevelEnabled works as intended. I was able to produce this:
2024-12-05 17:11:27.838 [info] vscode log level: info
2024-12-05 17:11:27.838 [info] is debug enabled?: true
and I believe its because the internal log level is debug until the user changes it based on the code here:
aws-toolkit-vscode/packages/core/src/shared/logger/activation.ts
Lines 43 to 49 in aa332da
| logChannel.onDidChangeLogLevel?.((logLevel) => { | |
| const newLogLevel = fromVscodeLogLevel(logLevel) | |
| mainLogger.setLogLevel(newLogLevel) // Also logs a message. | |
| }) | |
| mainLogger.setLogLevel('debug') // HACK: set to "debug" when debugging the extension. | |
| setLogger(mainLogger) |
I see the comment so I am wondering if there something special about the fact that I am running locally? Otherwise this seems like a bug.
Once I manually set the log level (i.e. trigger that event) this doesn't happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think when I added that "HACK" line, I assume that something in vscode would always overwrite the log-level, except when running in debug-mode. That line definitely needs some attention.
Perhaps the easiest fix is to wrap that line in if (!isRelease() && ...) or whatever
## Problem
We want to only log file paths when in debug mode, but the connect
script has no way of determining this.
## Solution
- pass log level to connect script.
- use it to determine what to log.
Example logs:
```
2024/12/05 15:50:24 ==============================================================================
2024/12/05 15:50:24 LOG_LEVEL=3
2024/12/05 15:50:24 AWS_REGION=us-east-1
2024/12/05 15:50:24 SESSION_ID=...
2024/12/05 15:51:11 ==============================================================================
2024/12/05 15:51:11 LOG_LEVEL=1
2024/12/05 15:51:11 AWS_REGION=us-east-1
2024/12/05 15:51:11 SESSION_ID=...
2024/12/05 15:51:11 AWS_SSM_CLI=.../Amazon/sessionmanagerplugin/bin/session-manager-plugin
2024/12/05 15:51:11 LOG_FILE_LOCATION=/.../ec2.{instanceId}.log
2024/12/05 15:51:55 ==============================================================================
2024/12/05 15:51:55 LOG_LEVEL=2
2024/12/05 15:51:55 AWS_REGION=us-east-1
2024/12/05 15:51:55 SESSION_ID=default-uk9cv4h86y5rdbrzarlkj9opci
2024/12/05 15:51:56 AWS_SSM_CLI=../Amazon/sessionmanagerplugin/bin/session-manager-plugin
2024/12/05 15:51:56 LOG_FILE_LOCATION=/.../ec2.{instanceId}.log
```
---
- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
Problem
We want to only log file paths when in debug mode, but the connect script has no way of determining this.
Solution
Example logs:
feature/xbranches will not be squash-merged at release time.License: I confirm that my contribution is made under the terms of the Apache 2.0 license.