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 exampleThe Flask Mega-Tutorial, Part VII: Unit Testing - miguelgrinberg.com
沒有留言:
張貼留言