Django Database Based Automated Logging - finally solved and done in a proper way.
Project description
Introduction
Django Automated Logging - finally solved and done in a proper way.
This package automaticially tracks, requests, model changes, requests - to a database or to another logger. It is your choice what to do.
What are the features?
comes with an built-in database logger
easy to setup
extensible
feature-rich
many options to choose from - including the exclusion of certain packages, aswell as the disabling of database based logger
does what it needs to do - nothing more.
completely automated - nothing needs to be included from you, besides in the settings.py of your project.
This python package also catches logging messages unrelated to the package itself, if this is wanted - unrelated logging statements from e.g. your code, or djangos code can be catched. You just need to include the database handler to your handlers in LOGGING and enable the module unspecified.
Setup
Everything changed needs to be changed in the settings.py
In the variable MIDDLEWARE append: 'automated_logging.middleware.AutomatedLoggingMiddleware'
In the variable INSTALLED_APPS append 'automated_logging'
In the variable LOGGING add in the handlers section (this is only required if you want database based logging):
'db': { 'level': 'INFO', 'class': 'automated_logging.handlers.DatabaseHandler', }
In the variable LOGGING add to the loggers section (this is only required if you want database based logging):
'automated_logging': { 'level': 'INFO', 'handlers': ['db'], 'propagate': True, }, 'django': { 'level': 'INFO', 'handlers': ['db'], 'propagate': True, },
python3 manage.py migrate automated_logging
LOGGING attributes are just for recommondations and can be of course modified to your liking.
Configuration
You can configure the plugin by adding the variable AUTOMATED_LOGGING The defaults are, these can be partially overwritten
from logging import INFO
AUTOMATED_LOGGING = {
'exclude': ['Session', 'automated_logging', 'basehttp'],
'modules': ['request', 'model', 'unspecified'],
'to_database': True,
'loglevel': {'model': INFO,
'request': INFO}
}
In exclude automated_logging, basehttp and admin are recommended to be included - due to potentially having multiple redundant logging entries. Two modules are available: request and model, these can be disabled, if needed. The database integration can be - not recommended - be disabled. The logger also needs to be disabled. The loglevel does indicate on which level things should be reported to other loggers, INFO or DEBUG is recommendend. Having ERROR or CRITICAL set is possible, but not recommended.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for django-automated-logging-3.5.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a492a53b61bc1fdf149e729beed4fbaf3b4e956f8f20f92fa8b445d864f7365 |
|
MD5 | 1c5f21f24135026d9ea2780344bacf19 |
|
BLAKE2b-256 | 68ce42d7e3f004769a23cfd8f809d0ea9455aae0a3b4e18a3998366a38e8836d |