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
Logging: 'client.setup_logging()' doesn't identify the underlying platform #7
Comments
I also have the same issue. I've followed the instructions here: https://cloud.google.com/logging/docs/setup/python But when viewing the logs in the Cloud web Console they're all badly formatted (line breaks are missing, so tracebacks are unreadable) and the 'level' info is missing, so you can't filter by info/warning/error/etc. This has got to be a bug in the library. It can't possibly be deliberate to have the logs look this terrible, or to require such levels of weird voodoo configuration to get it the formatting to work. |
I filed https://issuetracker.google.com/issues/150734081 and then stumbled on this issue, which is basically a dupe of both the problem and workaround. +1 to no voodoo to getting logging working properly. According to [the docs]:(https://cloud.google.com/run/docs/logging#writing_structured_logs)
Both the |
Is there any update on this or workarround ? It makes application monitoring very difficult... |
Currently, this library doesn't integrate well with newer GCP environments like Cloud Run and Cloud Functions. This is a known high-priority issue we're working on fixing this quarter. @oliviernguyenquoc As reported above, you should be able to set the handler explicitly as a workaround. Is that not working for you? |
@daniel-sanche : This work arround is not working on Cloud Run. We tried multiple times, by multiple developpers. This is an important feature to track our bug in production. Thanks ! |
Can you explain what you're seeing vs what you expect to see? Cloud Run isn't yet officially supported by the library, so it won't be auto-detected. But you should still be able to see logs, and populate missing fields manually. Are you seeing any logs on Cloud Run at all? I'm hoping to add full Cloud Run support this quarter. But we need to add better tests and make a couple other structural fixes first |
Logs are appearing well in cloud logging, but not with the right logging level. But we would need to get noticed as soon as an error logging is triggered in production. Thanks for your work and we widely waiting for this feature :) |
Hmm I did a quick test with the code described in the docs and the severity fields seemed to work for me on Cloud Run. If you can send me a container image that reproduces your issue, I can try to take a look and find a workaround for you |
This should be fixed after #200. You will see it in the next release |
My objective is to format correctly the logs into my Python app for having a good ingestion and formatting on Stackdriver logging console with level well interpreted.
The standard logging doesn't work for App Engine python 3.7 (work in Python 2) and on Cloud Run, because the logs aren't formatted in FluentD.
However, with Cloud Function, it's the case.
I found how to perform a workaround, (see example), but I think there is a bug in your library. Indeed, the function
client.setup_logging()
should set up my logger with the correct format according with the environment.It's not the case, and that's why I have to implement the workaround. Sadly, this workaround don't take into account the environment and when I run locally the app, I have this log trace:
Which is in FluentD format, but barely lisible.
The automatic configuration promised at this page doesn't happen!
Environment details
General, Core, and Other are also allowed as types
Logging API for App Engine and Cloud Run
OS type and version
Python 3.7, linux( appengine, container, local environment)
Python version and virtual environment information:
python --version
3.7. Version not detailed because occur on App Engine
google-cloud- version:
pip show google-<service>
orpip freeze
google-cloud-logging==1.14.0
Steps to reproduce
Deploy an app on Cloud Run or App Engine standard Python 3.7. Bellow an example with the workaround. Try to change the log handler with
client.setup_logging()
no special formater are set, and the log on Stackdriver aren't well ingested.Code example
This is a working example. I don't use client.setup_logging()
Thanks!
The text was updated successfully, but these errors were encountered: