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

This version
History Node

1.0

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
db_logger-1.0-py3-none-any.whl (4.5 kB) Copy SHA256 hash SHA256 Wheel py3
db-logger-1.0.tar.gz (3.0 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page