Skip to content

Complete Python Sample Code for Logging API #312

Closed

Description

@speedplane

Most languages have sample code for writing to the Logging API, such as Node.js.

However the Python sample code only has sample code for reading the logging API, not writing to it. Notice also that there is very little sample code in the documentation.

Activity

  1. waprin commented on Apr 29, 2016

    @waprin
    Contributor

    The reason there is not much sample code is that the idea is that you setup the fluentd logging agent (which is automatically setup on App Engine Flexible and for which we include instructions on GCE), and after that point you use standard Python logging. However you raise a valid point that the documentation is a little bit all over the place and a few more samples wouldn't hurt so I'll look into improving it.

  2. self-assigned this
    on Apr 29, 2016
  3. speedplane commented on Apr 29, 2016

    @speedplane
    Author

    Thanks @waprin.

    I recently moved to the Flexible environment from App Engine Classic. Unfortunately, as a result, my logs are no longer nested within each request. The logs are all denormalized and it is difficult to track which error log goes to which request.

    When I posted this on SO, I was told that in order to get nested logs back, I would need to write my own logger in python. So I started doing that, but quickly ran into a wall when I could not find any code on how to write a custom logger.

  4. theacodes commented on Apr 29, 2016

    @theacodes
    Contributor
  5. theacodes commented on May 6, 2016

    @theacodes
    Contributor

    @speedplane while we do plan to eventually provide a logger that goes directly to cloud logging as mentioned in googleapis/google-cloud-python#1497, the bundling feature is to be determined.

    App Engine Standard's serving path and sandbox restrictions allowed us to easily associate a request with associated logs. This is much more complicated in Flexible, so at the moment it's not currently possible to bundle logs to requests in the UI. Please keep in mind that Flexible is beta and will continue to evolve.

    We'll leave this bug open to provide samples for the documentation page. @waprin do you mind taking that on? If not, feel free to assign to me.

  6. speedplane commented on Sep 20, 2016

    @speedplane
    Author

    @jonparrott Just curious, why was this closed?

  7. waprin commented on Sep 20, 2016

    @waprin
    Contributor

    @speedplane we have docs and samples on writing logs in Python. We also have a Python logging handler you might want to check out. Adding the trace id to nest the logs isn't done yet, not sure if the UI will support it yet either, we can re-open while I investigate that.

  8. reopened this on Sep 20, 2016
  9. theacodes commented on Feb 28, 2017

    @theacodes
    Contributor

    (Closing due to inactivity, feel free to comment and we'll re-open)

  10. 13 remaining items

  11. added a commit that references this issue on Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.triage meI really want to be triaged.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions