I've built a simple case to test:

# test.py
from flask import Flask
import logging

app = Flask(__name__)

LOGGER = logging.getLogger('whatever')
fh = logging.FileHandler('test.log', 'a'')
LOGGER.addHandler(fh)
LOGGER.setLevel(logging.DEBUG)

@app.route('/')
def hello():
    LOGGER.info('hello log')
    return 'Hello!'

if __name__ == '__main__':
    app.run()

And then:

$ uwsgi --socket 127.0.0.1:3031 --file /path/to/test.py --callable app

And it's not working it doesn't write to the log file.
What am I doing wrong?

Regards,
Gianluca

On Tue, Jul 17, 2012 at 11:44 AM, Gianluca Brindisi <[email protected]> wrote:
> Yes my app name is foobar.py and my logger is set as:
>
> logger = logging.getLogger('log-foobar')
>
> The uwsgi command is:
>
> uwsgi --file /path/to/foobar.py --callable app [other options]
>
>>> Hi,
>>> yes I am using a custom logger with a different name than the app but
>>> still no luck :(
>>> Also I can't even log trough the syslog handler (which otherwise works
>>> fine without wsgi).
>>>
>>
>> For changing the logger name i mean
>>
>> logger = logging.getLogger('foobar')
>>
>> if your app is called 'foobar.py' Flask will overwrite the previous logger.
>>
>> This is the relevant thread in flask list:
>>
>> http://flask.pocoo.org/mailinglist/archive/2011/8/10/no-logging-when-flask-deploy-with-nginx%2Buwsgi/#e7c5eb97e0540e45a0c8262dc19da94b
>>
>> --
>> Roberto De Ioris
>> http://unbit.it
>> _______________________________________________
>> uWSGI mailing list
>> [email protected]
>> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to