Skip to content
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

SNOW-1800528: Disabling logging without anything being logged to stdout is difficult #957

Closed
visnup opened this issue Nov 12, 2024 · 6 comments
Assignees
Labels
bug Something isn't working status-fixed_awaiting_release The issue has been fixed, its PR merged, and now awaiting the next release cycle of the connector. status-triage_done Initial triage done, will be further handled by the driver team

Comments

@visnup
Copy link

visnup commented Nov 12, 2024

Please answer these questions before submitting your issue.
In order to accurately debug the issue this information is required. Thanks!

  1. What version of NodeJS driver are you using?
    1.15.0

  2. What operating system and processor architecture are you using?
    darwin arm64

  3. What version of NodeJS are you using?
    v20.18.0

  4. What are the component versions in the environment (npm list)?
    N/A

  5. What did you do?

snowflake.configure({logLevel: "OFF"});
  1. What did you expect to see?

No logging to stdout anywhere. Instead, I see the message

{"level":"INFO","message":"[2:27:54.321 PM]: Configuring logger with level: -1, filePath: undefined, additionalLogToConsole: undefined"}

logged to console/stdout before it finally turns off. This seems to defeat the purpose of silencing logging to stdout. This is important to me because the output to my program (querying Snowflake) is used as input to another process, and the downstream process is confused by seeing Snowflake logging output.

As a workaround, I've instead done

import Logger from "snowflake-sdk/lib/logger.js";
Logger.getInstance().configure({level: -1});

but this isn't documented anywhere. Other workarounds like setting additionalLogToConsole to false doesn't work because a log file isn't set, and setting logFilePath also triggers that initial, unwanted message:

if (logLevel != null || logFilePath) {
Logger.getInstance().info('Configuring logger with level: %s, filePath: %s, additionalLogToConsole: %s', logLevel, logFilePath, additionalLogToConsole);

@visnup visnup added the bug Something isn't working label Nov 12, 2024
@github-actions github-actions bot changed the title Disabling logging without anything being logged to stdout is difficult SNOW-1800528: Disabling logging without anything being logged to stdout is difficult Nov 12, 2024
@sfc-gh-dszmolka sfc-gh-dszmolka self-assigned this Nov 13, 2024
@sfc-gh-dszmolka sfc-gh-dszmolka added the status-triage Issue is under initial triage label Nov 13, 2024
@sfc-gh-dszmolka
Copy link
Collaborator

hi - you're right, that's not how OFF loglevel intended to work. we'll take a look.

@sfc-gh-dszmolka sfc-gh-dszmolka added status-pr_pending_merge A PR is made and is under review status-triage_done Initial triage done, will be further handled by the driver team and removed status-triage Issue is under initial triage labels Nov 13, 2024
@sfc-gh-dszmolka
Copy link
Collaborator

sfc-gh-dszmolka commented Nov 13, 2024

PR #958 edit: merged, will be part of the next upcoming release cycle

@sfc-gh-dszmolka sfc-gh-dszmolka added status-fixed_awaiting_release The issue has been fixed, its PR merged, and now awaiting the next release cycle of the connector. and removed status-pr_pending_merge A PR is made and is under review labels Nov 13, 2024
@velocityzen
Copy link

When is this going to be released? This is critical bug as it makes the whole STDOUT unusable.

@sfc-gh-dszmolka
Copy link
Collaborator

sfc-gh-dszmolka commented Dec 3, 2024

thank you for bearing with us while this is getting released! Currently, since we also need to consider other things which will be included in the release, there's unfortunately no more precise estimation for the release date than we hoping to be able to do it this week.

Until the release is actually out, if this is a critical issue for you, as a mitigation you can try:

  • git clone this repo
  • npm install from master branch
  • requireing the directory which has the master branch installed, instead of snowflake-sdk
    which master branch already has the fix.

@visnup
Copy link
Author

visnup commented Dec 6, 2024

@velocityzen I also included a workaround above which is non-obvious but works for me for now.

@sfc-gh-dszmolka
Copy link
Collaborator

released with Snowflake Node.js driver v2.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working status-fixed_awaiting_release The issue has been fixed, its PR merged, and now awaiting the next release cycle of the connector. status-triage_done Initial triage done, will be further handled by the driver team
Projects
None yet
Development

No branches or pull requests

3 participants