From ac0d2c0fac3817aa7c1a2b89bf314ba5c9562124 Mon Sep 17 00:00:00 2001 From: Axel Haustant Date: Sun, 1 Oct 2017 14:15:41 +0200 Subject: [PATCH] Improve console logging for adhoc scripts --- CHANGELOG.md | 1 + udata/commands/__init__.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63ead863c9..46633fd3c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - **BREAKING** Switch to `Flask-Security`. `Flask-Security-Fork` should be uninstalled before installing the new requirements [#958](https://github.com/opendatateam/udata/pull/958) - Added a `udata info` command for diagnostic purpose [#1179](https://github.com/opendatateam/udata/pull/1179) - Add `.ttl` and `.n3` as supported file extensions [#1183](https://github.com/opendatateam/udata/pull/1183) +- Improve logging for adhoc scripts [#1184](https://github.com/opendatateam/udata/pull/1184) ## 1.1.8 (2017-09-28) diff --git a/udata/commands/__init__.py b/udata/commands/__init__.py index 6de35d4ec3..58e9b3e039 100644 --- a/udata/commands/__init__.py +++ b/udata/commands/__init__.py @@ -109,6 +109,11 @@ def set_logging(app): app.logger.handlers = [] app.logger.addHandler(handler) + logger = logging.getLogger('__main__') + logger.setLevel(log_level) + logger.handlers = [] + logger.addHandler(handler) + for name in app.config['PLUGINS']: logger = logging.getLogger('udata_{0}'.format(name)) logger.setLevel(log_level)