question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

setGlobalLogLevel, setLogLevel, muteLoggers don't work

See original GitHub issue

Describe the bug setGlobalLogLevel, setLogLevel and muteLoggers don’t change the logging behaviour.

To Reproduce Steps to reproduce the behavior:

  1. use setGlobalLogLevel, setLogLevel or muteLoggers to get fewer log messages
  2. Execute executeHttpRequest
  3. See a lot of ‘info’-level log messages

Expected behavior It should only show the appropriate log messages

Used Versions:

  • node version via node -v: v16.14.0
  • npm version via npm -v: 8.3.1
  • SAP Cloud SDK version you used as dependency: “@sap-cloud-sdk/core”: “^1.54.0”, “@sap-cloud-sdk/util”: “^2.1.0”

Impact / Priority

This makes the logs harder to read during development.

Affected development phase: Development Impact: Inconvenience, I

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
FrankEssenbergercommented, Mar 4, 2022

Good morning,

@nocheintobi is right and you have a mix of version 1 and version 2 of the SDK. We recommend to use the latest version and do not use core but the smaller pacakges like connectivity or OData depending on you use case. Here is a migration guide in case you have already some code in the old version. The breaking changes are not so large. I will create a backlog item about the log level issue. If you set one specific logger to error and do not touch the level on the messageContext this should block it.

Best Frank

1reaction
nocheintobicommented, Mar 4, 2022

Hi brodo, @sap-cloud-sdk/core should be removed as it has been split into different modules, one of such is @sap-cloud-sdk/util. After having fixed the imports, you should be able to influence logging behavior as it was before. What I have seen after updating is, that some messages appeared, that should have been muted by a less detailed log level of their respective logger but appeared anyway. It seems to me, that messageContexts win over loggers in precedence - so you might need to modify the log level for some messageContexts in addition. register-destination messageContext for example is one of those candidates, that appeared in the logs also their logger was set to error-level.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NestJS: How to set global log level for different environments
You can set up log levels in your main.ts file: const app = await NestFactory.create(AppModule, { logger: process.env.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found