setGlobalLogLevel, setLogLevel, muteLoggers don't work
See original GitHub issueDescribe the bug
setGlobalLogLevel
, setLogLevel
and muteLoggers
don’t change the logging behaviour.
To Reproduce Steps to reproduce the behavior:
- use
setGlobalLogLevel
,setLogLevel
ormuteLoggers
to get fewer log messages Execute executeHttpRequest
- 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:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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
orOData
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 toerror
and do not touch the level on the messageContext this should block it.Best Frank
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.