2014年2月25日 星期二

Python Flask logger

import logging

filename = '/'.join((os.path.dirname(os.path.realpath(__file__)), 'log/debug.log'))
format = "%    (asctime)s - %(name)s - %(levelname)s - %(message)s"
logging.basicConfig(filename=filename, format=format, level=5)
handler = logging.getLogger('myproject')
app.logger.addHandler(handler)




Rotating log example :
Flask logging example
The Flask Mega-Tutorial, Part VII: Unit Testing - miguelgrinberg.com

沒有留言:

張貼留言