Commit ae27d69a authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Refactored logging config.

parent c6a26187
......@@ -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')
......@@ -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'
......
......@@ -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:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment