Skip to main content

Disclaimer

Update from django-db-logger, due to inactivity of the original package.

Original readme

Django logging in database. For large projects please use Sentry

Screenshot

https://ciciui.github.io/django-db-logger/static/img/django-db-logger.png

Dependency

  • Django>=1.9

  • Python 2.7+/3.6+

License

MIT

Quick start

  1. Install

pip install django-db-logs
  1. Add “django_db_logs” to your INSTALLED_APPS setting like this

INSTALLED_APPS = (
    ...
    'django_db_logs',
)
  1. Add handler and logger to LOGGING setting like this

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'verbose': {
            'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
        },
        'simple': {
            'format': '%(levelname)s %(asctime)s %(message)s'
        },
    },
    'handlers': {
        'db_log': {
            'level': 'DEBUG',
            'class': 'django_db_logs.db_log_handler.DatabaseLogHandler'
        },
    },
    'loggers': {
        'db': {
            'handlers': ['db_log'],
            'level': 'DEBUG'
        }
    }
}
  1. Run python manage.py migrate to create django-db-logs models.

  2. Use django-db-logs like this

import logging
db_logs = logging.getLogger('db')

db_logs.info('info message')
db_logs.warning('warning message')

try:
    1/0
except Exception as e:
    db_logs.exception(e)

Options

  1. DJANGO_db_logs_ADMIN_LIST_PER_PAGE: integer. list per page in admin view. default 10

  2. DJANGO_db_logs_ENABLE_FORMATTER: boolean. Using formatter options to format message.``True`` or False, default False

Release files for django-db-logs 0.1

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-db-logs 0.1
File Size Uploaded
django-db-logs-0.1.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-db-logs 0.1
File Interpreter ABI Platform
django_db_logs-0.1-py3-none-any.whl Python 3 none any Details

Total release size:14.0 kB

Release files / django-db-logs-0.1.tar.gz

Download URL django-db-logs-0.1.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
1b02b1348de016b5b64337c1efc4440866ba03098cdbecd887f748f8ea4555f5
BLAKE2b-256 checksum
How to use checksums
ff92f0d7f52436d351cc2fd7ea32a1fd0941f7f2727f9c858663475d21ee43b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.9

Release files / django_db_logs-0.1-py3-none-any.whl

Download URL django_db_logs-0.1-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aa9ac77c8363069e634ee7328f7460f3331f88fcdeac61a66a47863b6fb975d4
BLAKE2b-256 checksum
How to use checksums
3d190f4fa918a897841e736db1ca34e666d0ed11d8a1a4d1d9f291e20d33a889
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.9

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files

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