Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make logging level of the django app configurable #2078

Merged
merged 10 commits into from
Jan 2, 2025
6 changes: 6 additions & 0 deletions dandiapi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
from __future__ import annotations

from importlib.metadata import version
import logging

from django.conf import settings

# This project module is imported for us when Django starts. To ensure that Celery app is always
# defined prior to any shared_task definitions (so those tasks will bind to the app), import
# the Celery module here for side effects.
from .celery import app as _celery_app # noqa: F401

__version__ = version('dandiapi')

# Configure the logging level on all DANDI loggers.
logging.getLogger(__name__).setLevel(settings.DANDI_LOG_LEVEL)
1 change: 1 addition & 0 deletions dandiapi/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def mutate_configuration(configuration: type[ComposedConfiguration]):
DANDI_DANDISETS_BUCKET_PREFIX = values.Value(default='', environ=True)
DANDI_DANDISETS_LOG_BUCKET_NAME = values.Value(environ_required=True)
DANDI_DANDISETS_EMBARGO_LOG_BUCKET_NAME = values.Value(environ_required=True)
DANDI_LOG_LEVEL = values.Value(default='INFO', environ=True)
DANDI_ZARR_PREFIX_NAME = values.Value(default='zarr', environ=True)

# Mainly applies to unembargo
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ passenv =
DJANGO_DANDI_API_URL
DJANGO_DANDI_JUPYTERHUB_URL
DJANGO_DANDI_DEV_EMAIL
DJANGO_DANDI_LOG_LEVEL
DANDI_ALLOW_LOCALHOST_URLS
extras =
dev
Expand All @@ -69,6 +70,7 @@ passenv =
DJANGO_DANDI_API_URL
DJANGO_DANDI_JUPYTERHUB_URL
DJANGO_DANDI_DEV_EMAIL
DJANGO_DANDI_LOG_LEVEL
extras =
dev
commands =
Expand Down