Code Monkey home page Code Monkey logo

Comments (10)

boring-cyborg avatar boring-cyborg commented on September 14, 2024

Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link

from powertools-lambda-python.

heitorlessa avatar heitorlessa commented on September 14, 2024

trying to reproduce it now... from my recollection that only happens when you have \n since CloudWatch Logs creates a new line like that. Logger prints as a string. The only behavior change is when you have POWERTOOLS_DEV env var where we increase indentation .

from powertools-lambda-python.

heitorlessa avatar heitorlessa commented on September 14, 2024

Couldn't reproduce, will try more scenarios

  • Same code snippet on Python 3.11
  • Same code snippet older Powertools for AWS Lambda version (2.31.0)
  • Same code snippet on Python 3.12
  • Use POWERTOOLS_DEV env
  • Use POWERTOOLS_DEBUG env
  • Copy existing Logger config to other std/libraries (noticed in your screenshot X-Ray/boto appears)
image

from powertools-lambda-python.

heitorlessa avatar heitorlessa commented on September 14, 2024

As expected, reproduced with POWERTOOLS_DEV where indentation is increased for local debugging. Checking the last scenario to triple check.

Local effect (intended use case)

image

Local effect with SAM CLI logs pulling from CloudWatch Logs

image

CloudWatch Logs effect (extra indentation is transformed

image

from powertools-lambda-python.

heitorlessa avatar heitorlessa commented on September 14, 2024

All scenarios tested, this only seems to occur due to POWERTOOLS_DEV as expected -- could you please check whether you have that turned on?


Logger config copied to boto3+X-Ray SDK loggers + DEBUG log level

image

from powertools-lambda-python.

thault avatar thault commented on September 14, 2024

Looks like you are correct that it's from the POWERTOOLS_DEV; when I set that to false the logs started populating as single lines.

So this is expected behavior when POWERTOOLS_DEV is true; is there a way to work around that? It makes sense when running locally with SAM, but it makes the logs a pain when testing in AWS.

from powertools-lambda-python.

heitorlessa avatar heitorlessa commented on September 14, 2024

I'm sure we can figure something out -- what made you enable POWERTOOLS_DEV? That will help understand alternative solutions or trade-offs we might be able to make.

Customers also use this feature with pytest live debugging feature.

from powertools-lambda-python.

heitorlessa avatar heitorlessa commented on September 14, 2024

Summarizing our discussion on Discord.

What you were after was POWERTOOLS_DEBUG to get extra details about every operation (Logger) while using CloudWatch Logs view.

POWERTOOLS_DEV on the other hand is focused on local development, where you want to run your code locally with tools like SAM CLI, or pytest live log feature.

I'm closing this issue and created a PR to make this more explicit in our docs to prevent future confusion.

Thank you so much for taking the time to report this and help improve the docs!

from powertools-lambda-python.

github-actions avatar github-actions commented on September 14, 2024

⚠️COMMENT VISIBILITY WARNING⚠️

This issue is now closed. Please be mindful that future comments are hard for our team to see.

If you need more assistance, please either tag a team member or open a new issue that references this one.

If you wish to keep having a conversation with other community members under this issue feel free to do so.

from powertools-lambda-python.

github-actions avatar github-actions commented on September 14, 2024

This is now released under 2.34.0 version!

from powertools-lambda-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.