I have a Flask
application inside of Docker
that was logging into docker logs
when it was running without UWSGI
in front. Now
I had a similar problem (Special: I wanted to use the syslog). First I had to add a rule to the Dockerfile:
RUN apt-get install -y rsyslog
service rsyslog start
Flask comes with build-in logging, so I just had to add some twigs
from flask import Flask
import logging
import logging.handlers
handler = logging.handlers.SysLogHandler(address = '/dev/log')
handler.setFormatter(logging.Formatter('flask [%(levelname)s] %(message)s'))
app = Flask(__name__)
app.logger.addHandler(handler)
Additional settings can be handled through the syslog-daemon