Skip to main content

Save logging message to database

Project description

Django database logger

Quick start

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

  2. 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_logger.db_log_handler.DatabaseLogHandler'
        'loggers': {
            'db': {
                'handlers': ['db_log'],
                'level': 'DEBUG'
  3. Run python migrate to create django-db-logger models.

  4. Use django-db-logger like this:

    import logging
    db_logger = logging.getLogger('db')'info message')
    db_logger.warning('warning message')
    except Exception as e:

Project details

Download files

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

Source Distribution

django-db-logger-0.1.tar.gz (4.3 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page