why does flask logs only when app.debug = True?

Viewed 4077

in main :

handler = RotatingFileHandler('/tmp/mylog')
handler.setLevel(logging.DEBUG)
app.logger.addHandler(handler)
my_glob.logger = app.logger
app.debug = True
app.run(host='0.0.0.0', port=80)

in a 'url' :

import my_glob
...
handling get request here:
  logger = my_glob.logger
  logger.info('this wont show unless app.debug=True is specified')
  logger.error('this always shows up')

if I do this, it works. If I remove app.debug = True, it doesn't work. But flask documentation says that app.debug is on local environments/debugging, not on production. So what should I use to enable logging on info/debug levels ?

1 Answers
Related