This commit is contained in:
parent
fc4f8b9d79
commit
01d7c76cff
@ -9,6 +9,8 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
RUN pip3 install -r requirements.txt
|
||||
|
||||
EXPOSE 8000
|
||||
CMD ["gunicorn", "-b", "0.0.0.0:8000", "app:app"]
|
||||
ENV GUNICORN_LOGLEVEL="info"
|
||||
|
||||
EXPOSE 8000
|
||||
CMD ["gunicorn", "-b", "0.0.0.0:8000", "--log-level", "${GUNICORN_LOGLEVEL}", "app:app"]
|
||||
|
||||
|
@ -48,3 +48,20 @@ app.add_url_rule("/healthz", "healthcheck", view_func=lambda: health.run())
|
||||
# start debugging if needed
|
||||
if __name__ == "__main__":
|
||||
app.run(debug=True)
|
||||
else:
|
||||
import os
|
||||
|
||||
if "gunicorn" in os.environ.get("SERVER_SOFTWARE", ""):
|
||||
import logging
|
||||
|
||||
gunicorn_logger = logging.getLogger('gunicorn.error')
|
||||
app.logger.handlers = gunicorn_logger.handlers
|
||||
app.logger.setLevel(gunicorn_logger.level)
|
||||
|
||||
jaeger_logger = logging.getLogger('jaeger_tracing')
|
||||
jaeger_logger.handlers = gunicorn_logger.handlers
|
||||
jaeger_logger.setLevel(gunicorn_logger.level)
|
||||
|
||||
app.logger.info("Gunicorn environment detected!")
|
||||
else:
|
||||
app.logger.info("Not gunicorn")
|
||||
|
Loading…
Reference in New Issue
Block a user