Skip to main content

A simple Django app to save logs to database

Project description

DB Logger is a simple Django app to save logs to database.

Quick start

  1. Add “db_logger” to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...
        'db_logger',
    ]
    
  2. Run python manage.py migrate to create the polls models.

  3. Add handler and logger to LOGGING setting like this:

    LOGGING = {
        'version': 1,
        'disable_existing_loggers': False,
        'formatters': {
            'verbose': {
                'format': "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
                'datefmt': "%d/%b/%Y %H:%M:%S"
            },
            'standard': {
                'format': '%(asctime)s [%(levelname)s] %(name)s: %(message)s'
            },
            'simple': {
                'format': '%(levelname)s %(message)s'
            },
        },
        'handlers': {
            'db_log': {
                'level': 'DEBUG',
                'class': 'db_logger.handlers.DbLogHandler'
            },
        },
        'loggers': {
            '': {
                'handlers': ['db_log'],
                'level': 'DEBUG',
            }
        }
    }
    
  4. Visit /admin/db_logger/dblogentry/ to check the logs.

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for db-logger, version 1.0
Filename, size File type Python version Upload date Hashes
Filename, size db_logger-1.0-py3-none-any.whl (4.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size db-logger-1.0.tar.gz (3.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page