diff --git a/nomad/config.py b/nomad/config.py index 742d984d068803d378eb3639edbf43dfe53191c7..1b92c5a5c2ddc064c888e5665b4a7dd1e51649a7 100644 --- a/nomad/config.py +++ b/nomad/config.py @@ -85,3 +85,5 @@ services = NomadServicesConfig( api_base_path=os.environ.get('NOMAD_API_BASE_PATH', '/nomad/api'), api_secret=os.environ.get('NOMAD_API_SECRET', 'defaultApiSecret') ) + +console_log_level = getattr(logging, os.environ.get('NOMAD_CONSOLE_LOGLEVEL', 'INFO'), 'INFO') diff --git a/nomad/processing/base.py b/nomad/processing/base.py index a03e15bc3a45da8ea6c3672b8244eb106ee69bc7..59ad1e351c8dcac52050b4ad9010e33638e6dde1 100644 --- a/nomad/processing/base.py +++ b/nomad/processing/base.py @@ -39,11 +39,12 @@ if config.logstash.enabled: @worker_process_init.connect def setup(**kwargs): + utils.get_logger(__name__).debug('test debug log entry') infrastructure.setup() app = Celery('nomad.processing', broker=config.celery.broker_url) - +app.conf.update(worker_hijack_root_logger=False) PENDING = 'PENDING' RUNNING = 'RUNNING' diff --git a/nomad/utils.py b/nomad/utils.py index fa48143ae9fe482007950cad561ff1aad90da07e..d83335bef270dc9e7266e13fe725e47e2224b21b 100644 --- a/nomad/utils.py +++ b/nomad/utils.py @@ -116,10 +116,10 @@ if not _logging_is_configured: wrapper_class=structlog.stdlib.BoundLogger) # configure logging in general - logging.basicConfig(level=logging.DEBUG, stream=sys.stdout) + logging.basicConfig(stream=sys.stdout) root = logging.getLogger() for handler in root.handlers: - handler.setLevel(logging.WARNING if 'pytest' not in sys.modules else logging.CRITICAL) + handler.setLevel(config.console_log_level if 'pytest' not in sys.modules else logging.CRITICAL) # configure logstash if config.logstash.enabled and 'pytest' not in sys.modules: