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
Enable logging via environment variable #1739
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1739 +/- ##
==========================================
+ Coverage 77.09% 95.7% +18.61%
==========================================
Files 189 189
Lines 6593 6594 +1
Branches 1343 1344 +1
==========================================
+ Hits 5083 6311 +1228
+ Misses 1510 283 -1227
Continue to review full report at Codecov.
|
Hi @sabrehagen, This seems like a useful addition to the SDK, but we tend to shy away from adding new environment variables (particularly ones prefixed with |
Hi @jeskew, how did you go asking around? Can we get something merged? :) |
What lends further credence to this is that If this functionality were added into |
Hi @jeskew, do you have any updates on this? I am having trouble seeing any reason why this isn't a useful addition to the library. Thanks :) |
Hi @sabrehagen, Would you be open to choosing a new mechanism for enabling debug mode? I would be much more open something that makes it clear that the mechanism is specific to this library or to Node applications in general. I know many libraries will enable debug mode if |
I agree. Most developers will be operating in a
What mechanism do you propose? I've proposed the use of an environment variable as this is de facto in the Node.js ecosystem (example 1, example 2, example 3, example 4, example 5).
By supplying the |
@sabrehagen My concern is that we cannot offer a simple on/off experience in all AWS SDKs, so using the |
I see where you're coming from. |
I've updated the environment variable name. What's the ETA for getting this merged? |
@jeskew Hello again, I wanted to ping you on this issue as I encounter the need for it daily, and want to see what I can do to help get it in the SDK :) |
Hi again @jeskew, it's been a bit over a week since I've heard from you. What would you like done to this PR to get it merged? I have a severe need for this feature every day, often first thing when I start work. Debugging the AWS SDK operations by having to modify the codebase every time I want to see what the SDK is doing is exceptionally time consuming and fragile. This explains my persistence with following up :) |
I'll try to get this prepped for merge today. In the meantime, you can use an environment variable to set the debug level of your code by setting the const AWS = require('aws-sdk');
AWS.config.update({ logger: process.env.AWSJS_DEBUG ? console : undefined }); |
This was merged in as part of #1783. Thanks for your contribution! |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
Hi,
I often find it desirable during debugging to turn on logging for
aws-sdk
so that I can see the requests and their parameters being made to AWS. To enable logging, I am required to alter my code with:We use
aws-sdk
in approximately 50 repositories as part of our microservice architecture. This alteration becomes unwieldy when I need to turn on logging for multiple services. It would be highly convenient and efficient to be able to set an environment variable that would turn on logging inaws-sdk
, for exampleAWS_DEBUG=1
.I have made a demonstration of how this might be done in this PR, albeit a bit raw. If you think it can be done in a better place, please alter the PR. I wanted to create a sample implementation to kick of discussion around what I see as a very necessary and useful feature.