SAP / cf-python-logging-support

Logging library for python applications deployed on SAP Cloud Platform - CloudFoundry environment
Apache License 2.0
17 stars 11 forks source link

Unable to see logs in SAP Cloud Foundry portal #44

Closed ankur0101 closed 3 years ago

ankur0101 commented 3 years ago

Hello,

I am using Ubuntu docker image to run my application. I forked it wit addition of python3 and pip3 so I do have direct access to them once I do cf ssh my-app.

I created a sample log_test.py file with following code:

import logging
from sap import cf_logging

cf_logging.init()

logger = logging.getLogger("cli.logger")
logger.info('hi')

However when I run it using python3 log_test.py, I do get the following message:

{"component_id": "a43e1b1b-504e-4f6d-924d-c7d751735606", "component_name": "my-app", "component_instance": "0", "space_id": "e36f0c53-888e-468b-a282-6bff5107b570", "space_name": "dev", "container_id": "10.32.2.11", "component_type": "application", "written_at": "2020-11-18T14:07:05.349Z", "written_ts": 1605708425349822000, "correlation_id": "-", "layer": "python", "type": "log", "logger": "cli.logger", "thread": "MainThread", "level": "INFO", "line_no": 7, "msg": "hiiii"}

But hiiii messages does not get recorded in cloud foundry portal

image

What needs to be done to get my data from python app into application logs area from above screenshot?

ankur0101 commented 3 years ago

Function print("did the job!")