Skip to main content

pypi version license python versions Build Status Code coverage

django-logger-panel

An easy way to change the log level in runtime

Installation

pip install django-logger-panel

Features

  • List all active loggers .
  • Change any logger level in run time.
  • Change all logger levels at once.
  • Display logger information.

Settings.py

INSTALLED_APPS

Add loggerpanel to installed apps

INSTALLED_APPS = [
    ...
    'django_logger_panel',    
]

LOGGING

Make sure the root has a handler set at the LOGGING dictionary in settings.py, as described in the Django Documentation. This is the root logger configuration and will allow all loggers with no handler to inherit it from the root.

Example:

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'console': {
            'format': '%(asctime)s %(levelname)-8s %(name)-12s %(message)s',
        },
    },
    'handlers': {
        'console': {
            'class': 'logging.StreamHandler',
            'formatter': 'console',
        },
    },
    'root': {
        'level': 'DEBUG',
        'handlers': ['console'],
    },
}

LOGGER_PANEL_BASE_URL

Optionally, change the default base url /loggers/ by setting the property LOGGER_PANEL_BASE_URL. This variable is not required.

LOGGER_PANEL_BASE_URL = "/another-path/"

urls.py

Add the django_logger_panel.urls to the urlpatterns.

urlpatterns = [
    ...
    path("", include("django_logger_panel.urls")),
    ...

]

Screenshots

Logger Panel

logger panel

Logger Details

logger details

REST API

List loggers

Curl Example:

curl http://localhost:8000/loggers/ -H 'Accept:application/json'

Response:

{
  "log_levels": {
    "CRITICAL": 50,
    "ERROR": 40,
    "WARNING": 30,
    "INFO": 20,
    "DEBUG": 10,
    "NOTSET": 0
  },
  "loggers": [
    {
      "name": "_all_loggers_",
      "level": {
        "code": 0,
        "name": "NOTSET"
      },
      "effectiveLevel": {
        "code": 0,
        "name": "NOTSET"
      },
      "parent": null
    },
    {
      "name": "root",
      "level": {
        "code": 30,
        "name": "WARNING"
      },
      "effectiveLevel": {
        "code": 30,
        "name": "WARNING"
      },
      "parent": null
    },
    {
      "name": "django",
      "level": {
        "code": 20,
        "name": "INFO"
      },
      "effectiveLevel": {
        "code": 20,
        "name": "INFO"
      },
      "parent": "root"
    },
    {
      "name": "django.db.backends",
      "level": {
        "code": 0,
        "name": "NOTSET"
      },
      "effectiveLevel": {
        "code": 20,
        "name": "INFO"
      },
      "parent": "django"
    },
    {
      "name": "django.request",
      "level": {
        "code": 0,
        "name": "NOTSET"
      },
      "effectiveLevel": {
        "code": 20,
        "name": "INFO"
      },
      "parent": "django"
    },
    {
      "name": "django.server",
      "level": {
        "code": 20,
        "name": "INFO"
      },
      "effectiveLevel": {
        "code": 20,
        "name": "INFO"
      },
      "parent": "django"
    },
    {
      "name": "django.security.csrf",
      "level": {
        "code": 0,
        "name": "NOTSET"
      },
      "effectiveLevel": {
        "code": 20,
        "name": "INFO"
      },
      "parent": "django"
    },
    {
      "name": "django.db.backends.schema",
      "level": {
        "code": 0,
        "name": "NOTSET"
      },
      "effectiveLevel": {
        "code": 20,
        "name": "INFO"
      },
      "parent": "django.db.backends"
    }    
  ]
}

Return a single logger

Curl Example:

curl http://localhost:8000/loggers/django.db.backends -H 'Accept:application/json'

Response:

{
  "name": "django.db.backends",
  "level": {
    "code": 0,
    "name": "NOTSET"
  },
  "effectiveLevel": {
    "code": 20,
    "name": "INFO"
  },
  "parent": "django"
}

Change logger level

Curl Example:

curl -X POST http://localhost:8000/loggers/django.db.backends -d '{"logger_level": "DEBUG"}'

Response:

{
  "name": "django.db.backends",
  "level": {
    "code": 10,
    "name": "DEBUG"
  },
  "effectiveLevel": {
    "code": 10,
    "name": "DEBUG"
  },
  "parent": "django"
}

Metadata

Release files for django-logger-panel 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-logger-panel 0.1.6
File Size Uploaded Provenance
django-logger-panel-0.1.6.tar.gz 15.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-logger-panel 0.1.6
File Interpreter ABI Platform
django_logger_panel-0.1.6-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 31.4 kB

Release files / django-logger-panel-0.1.6.tar.gz

Download URL django-logger-panel-0.1.6.tar.gz
Size 15.2 kB
Tags Source
SHA-256 checksum
How to use checksums
df128609ec9851025b71adadfe3008bc8307e011076b803d8714ef848b3d4f76
BLAKE2b-256 checksum
How to use checksums
3eadc0e4e878265d60edae1165b7df911272f6be3ba34811520662f5076205c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.5

Release files / django_logger_panel-0.1.6-py2.py3-none-any.whl

Download URL django_logger_panel-0.1.6-py2.py3-none-any.whl
Size 16.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
9c19d10707dc1bdbb81ae8661b3f2a7532da410480a1dac9307baf89aa36e6fc
BLAKE2b-256 checksum
How to use checksums
e71327d839797f64f7ca3d27d97bd39dbbc14df04262644048906bbbc4e7749c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.5

Security for django-logger-panel 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page