mod_wsgi-express set log level
<p><strong>How to set the log level</strong> in a wsgi application started with</p>
<pre><code>mod_wsgi-express ./mywsgi.py
</code></pre>
<p>? This is the most simple setup. <a href="https://stackoverflow.com/questions/12385915/logging-in-python-mod-wsgi-app">Logging in python + mod_wsgi app</a> talks about config files, as does the <a href="http://modwsgi.readthedocs.org/en/develop/user-guides/quick-configuration-guide.html?highlight=--log-level" rel="nofollow noreferrer">Quick Configuration Guide</a>. The <code>mod_wsgi-express</code> command needs only the python wsgi file to operate.</p>
<p>Using the <code>--log-level</code> flag, as mentioned in <a href="http://modwsgi.readthedocs.org/en/develop/release-notes/version-4.4.10.html" rel="nofollow noreferrer">the release notes</a></p>
<pre><code>mod_wsgi-express --log-level info ./mywsgi.py
</code></pre>
<p>did not show <code>logging.info</code> messages. Neither did the <code>--debug-mode</code> flag <a href="http://file:///home/uni/Downloads/using-modwsgi-express-as-development.html" rel="nofollow noreferrer">mentioned by @GrahamDumpleton</a>.</p>
<h3>Solved (see below), but still: minimal example</h3>
<pre><code>import logging
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)

def application(environ, start_response):
    status = '200 OK'
    logging.warning('warning log message')
    logging.info('info log message')

    output = &quot;hello world&quot;

    response_headers = [('Content-type', 'text/plain'),
                        ('Content-Length', str(len(output)))]
    start_response(status, response_headers)

    return [output]
</code></pre>