#200 set up logging separately from Flask app creation
Merged by dcallagh. Opened by dcallagh.
dcallagh/greenwave no-log-handlers-in-tests  into  master

Download 200.patch

In the tests we could call create_app() zero or more times, which meant
that log messages produced in the test process could be duplicated on
stdout many times depending on which set of tests had been run.

What we really want is:

  • logging configured and going to stdout in the WSGI app (as it is now);
  • logging configured with no handler in the test suite, so that pytest
    can capture the log messages.

Sure, let's try it. :+1:

Ah, but I forgot we have a third entry point which is the Flask dev server in run-dev-server.py...

Amended commit b5e4bde also updates run-dev-server.py to match.

I wonder if we should just be using gunicorn for the dev server as well, for consistency...

rebased onto b5e4bdeddc4793d48a6a88468bfce09a5fb61dde

Hmm actually there is a fourth entry point which is the fedmsg consumers... I didn't think about those. I am not sure where/how their logging is set up at all hmm. PR#199 probably would make a difference too.

Okay, so fedmsg-hub will configure all the logging stuff itself already. So this is fine. And indeed, we will need this for PR#199 since now the fedmsg consumers will also be calling create_app() so we don't want them adding duplicate log handlers on top of the ones already configured by fedmsg-hub.

Ack. :+1: still from me.

Pull-Request has been merged by dcallagh

Metadata