openfaas / openfaas/docs

Better description of logging in python flask templates

Open
#228 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Makefile
Stars
67
Forks
94
Avg merge
5h 51m
Merged PRs (30d)
1

Description

My actions before raising this issue

Python based templates which use flask doesn't "just work" when it comes to logging. The general:

write_debug: true

in the environmental variables flag doesn't efficiently enable logging. It is not clearly explained how to enable logging in the http/flask based python templates:

Expected Behaviour

Enabling write_debug: true flag in environmental variables and hope writing to STDERR/STDOUT would show logs when using the faas-cli logs feature. If not I would be able to find steps which will let me log from Flask based python images in the documentation or somewhere else.

Current Behaviour

Enabling write_debug: true flag in environmental variables doesn't log to STDERR/STDOUT and it is troublesome to find out how to enable logging.

Possible Solution

Better documentation of explicit steps which will make Flask/Http based python templates to "just work" when it comes to logging. We should discuss whether this could be fixed in the templates themselves, or we should go with better documentation/workaround for the logs in Python Flask.

Steps to Reproduce (for bugs)

1.Add in stack.yml for some function which uses the http python templates which use Flask:

environment:
    write_debug: true

2.Write to stderr in the handler funciton:

import sys


def handle(req):
...
    sys.stderr.write("some msg")
...
  1. See the message in logs missing.
  2. Try searching it in the official docs where logs are mentioned and see flask is not explained.

Context

Opening an Issue was requested as per conversation in Slack. It was troublesome to find out documentation on how exactly should logging happen in Python Flask templates.

Your Environment

  • FaaS-CLI version ( Full output from: faas-cli version ):
    N/A
  • Docker version docker version (e.g. Docker 17.0.05 ):
    N/A
  • Are you using Docker Swarm or Kubernetes (FaaS-netes)?
    N/A
  • Operating System and version (e.g. Linux, Windows, MacOS):
    N/A
  • Code example or link to GitHub repo or gist to reproduce problem:
    N/A
  • Other diagnostic information / logs from troubleshooting guide

Next steps

You may join Slack for community support.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked faas-cli logs documentation and the python-flask-template repository, then reproduce the reported stack.yml and handler steps. Check how Flask-based Python templates expose stderr/stdout and determine whether the result belongs in the docs or templates. Done means the official documentation gives explicit, verified logging steps for these templates.

Written by the indexing model from the issue text.

Assessment

Tech stack
flask, python
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.