Skip to main content

Django log viewer

Project description

pypi version license build status

Django Log Viewer allows you to read & download log files in the admin page by using DataTables. This project was modified from: https://bitbucket.org/inkalabsinc/django-log-viewer


https://i.imgur.com/IZQKm4T.png

Quick start

  1. Django Log Viewer is available directly from PyPI:

pip install django-log-viewer
  1. Add "log_viewer" to your INSTALLED_APPS setting like this

INSTALLED_APPS = [
    ...
    "log_viewer",
]
  1. Include the log viewer URLconf in your project urls.py like this

path('logs/', include('log_viewer.urls')),
  1. In your settings.py file create the following value

LOG_VIEWER_FILES = ['logfile1', 'logfile2', ...]
LOG_VIEWER_FILES_PATTERN = '*.log*'
LOG_VIEWER_FILES_DIR = 'logs/'
LOG_VIEWER_PAGE_LENGTH = 25       # total log lines per-page
LOG_VIEWER_MAX_READ_LINES = 1000  # total log lines will be read
LOG_VIEWER_PATTERNS = ['[INFO]', '[DEBUG]', '[WARNING]', '[ERROR]', '[CRITICAL]']

# Optionally you can set the next variables in order to customize the admin:
LOG_VIEWER_FILE_LIST_TITLE = "Custom title"
LOG_VIEWER_FILE_LIST_STYLES = "/static/css/my-custom.css"
  1. Create/register the logging

import logging
logger = logging.getLogger('LoggerName')
logger.info('The info message')
logger.warning('The warning message')
logger.error('The error message')
  1. Deploy static files by running the command

python manage.py collectstatic
  1. Start the development server and visit http://127.0.0.1:8000/logs/

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-log-viewer-1.1.4.tar.gz (75.2 kB view details)

Uploaded Source

File details

Details for the file django-log-viewer-1.1.4.tar.gz.

File metadata

  • Download URL: django-log-viewer-1.1.4.tar.gz
  • Upload date:
  • Size: 75.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

File hashes

Hashes for django-log-viewer-1.1.4.tar.gz
Algorithm Hash digest
SHA256 84dc1ae947d5fefcd73069e3d86ebfb17fc59f452ec0abf90ae72ae8caa40ed6
MD5 5a7339d217361e5ccdcdd2df48768d3b
BLAKE2b-256 f45f8e7179005a19a115125131f7b1d54c89d00362e5f4ff30679f4e94831744

See more details on using hashes here.

Supported by

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