Closed
Description
Thanks for stopping by to let us know something could be better!
PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.
Please run down the following list and make sure you've tried the usual "quick fixes":
- Search the issues already opened: https://github.com/googleapis/python-logging/issues
- Search StackOverflow: https://stackoverflow.com/questions/tagged/google-cloud-platform+python
If you are still having issues, please be sure to include as much information as possible:
Environment details
- OS type and version: Cloud Run
- Python version: 3.7
- pip version:
google-cloud-logging
version: 2.4.0
Steps to reproduce
- Set up StructuredLogHandler to write logs
- Write logs containing a '\n'
- Build the image and run it on Cloud Run
- See the Cloud Logging dashboard
Code example
def prep_structured_logging():
logger = logging.getLogger()
logger.setLevel(logging.INFO)
# Delete unused handlers
logger.handlers = []
client = google.cloud.logging.Client()
cloud_handler = StructuredLogHandler()
setup_logging(cloud_handler)
@app.route('/test_structured', methods=['POST'])
def test_structured():
prep_structured_logging()
text = request.values.get('text', 'logging text')
logging.error(text + "\n" + text)
return "Success!"
Stack trace
Making sure to follow these steps will guarantee the quickest resolution possible.
Thanks!