handler.setFormatter(logging.Formatter(
    '%(asctime)s - %(name)s - %(levelname)s - %(message)s'))
app.logger.addHandler(handler)
app.logger.setLevel(logging.DEBUG)

@app.route('/index')
def index():
    app.logger.debug('TESTING!')
hi()
return 'hi'
if __name__ == '__main__':
    app.run()
How can I log outside of main Flask module?