Closed gndrmnn closed 4 months ago
I've experienced this issue before while working with Kubernetes and Python, this is because Kubernetes is buffering the output of the application.
As with all buffers this will the output will be released/displayed as soon as a flush is invoked on the buffer or its limit is reached. You can prevent this default buffering by setting the environment variable PYTHONUNBUFFERED=1
This should solve the problem, but if it doesn't there are other things to look at like the encoding of the output etc.
To understand more of how this works: PYTHONUNBUFFERED Explained
I've experienced this issue before while working with Kubernetes and Python, this is because Kubernetes is buffering the output of the application.
As with all buffers this will the output will be released/displayed as soon as a flush is invoked on the buffer or its limit is reached. You can prevent this default buffering by setting the environment variable
PYTHONUNBUFFERED=1
This should solve the problem, but if it doesn't there are other things to look at like the encoding of the output etc.
To understand more of how this works: PYTHONUNBUFFERED Explained
Thanks. That indeed seems to have solved the problem.
We have successfully deployed the Zulip botserver using kubernetes and created a first bot with it. This bot and the botserver work nicely and communicate without a problem with our Zulip instance.
We are using the Python builtin logger inside the bot with
self.logger = logging.getLogger(__name__)
and then calls toself.logger.info
etc. However, these logging messages are somehow suppressed by the botserver. If we do akubectl logs <botserver-podname>
we simply get something like this:which contains all the expected log messages from flask/werkzeug but none of the ones we are logging in the bot code. Kubernets should forward anything that happens on stdout/stderr automatically, so I am really surprised by this result.
Note: Logging works like a charm when using the single
zulip-run-bot
command.I would also expect to find bot logs in the botserver log.