Closed yvz5 closed 4 years ago
@yvz5 how to print message, have you found the solution? thanks
@yvz5 how to print message, have you found the solution? thanks
Nope. I am not using openfaas anymore. Moved to azure functions.
Guys, I had same issue here, here is my solution:
tempalte/python3-flask/index.py
import sys
from logging.config import dictConfig
dictConfig({ 'version': 1, 'formatters': {'default': { 'format': '[%(asctime)s] %(levelname)s in %(module)s: %(message)s', }}, 'handlers': {'wsgi': { 'class': 'logging.StreamHandler', 'stream': 'ext://sys.stdout', 'formatter': 'default' }}, 'root': { 'level': 'INFO', 'handlers': ['wsgi'] } })
1. Then, edit your function py files, import current_app, write your logging statement `current_app.logger.info(xxx)`
```py
from flask import current_app as app
app.logger.info(config)
Hope this solution helps
Hi,
I tried passing app.logger to the function by adding
and calling it inside the function I get no error but the function does not actually get called, so there is a silent exception somewhere.
How do you log ? print does not show up even if I have write_debug env variable set to true