So I've figured it out, it was a stupid issue as expected.

The code to set up the logger was inside a function called inside the
block if '__name__' == '__main__' and it wasn't executed by uwsgi. I
moved it outside the block and everything is working as expected now.

I am sorry for the trouble.

Thanks for your time,
Gianluca

On Wed, Jul 18, 2012 at 6:40 AM, Roberto De Ioris <[email protected]> wrote:
>
>> 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?
>>
>
>
> I have tested your code and it works, does connecting with the browser
> shows 'Hello!' (just to be sure the callable is running) ?
>
>
>
> --
> 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