Skip to main content

SafeSysLogHandler recreates the connection to a remote logging server when the connection is lost, avoiding the `[errno 32] Broken Pipe` error which would occur when using the `SysLogHandler`.

Project description

https://img.shields.io/pypi/v/safe_syslog_handler.svg https://img.shields.io/travis/intelie/safe_syslog_handler.svg Documentation Status

SafeSysLogHandler recreates the connection to a remote logging server when the connection is lost, avoiding the [errno 32] Broken Pipe error which would occur when using the SysLogHandler.

Instalation

$ pip install safe_syslog_handler

Usage

If you have some simple logging configured, exemple:

from logging import config
LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'syslog': {
            'format': '%(asctime)s %(hostname)s %(name)s: #{filename:%(filename)s} #{line:%(lineno)d} #{process:%(process)d} #{thread:%(thread)d} %(message)s\n',
            'datefmt': '%b %d %H:%M:%S',
        },
    },
    'loggers': {
        'my-app': {
            'handlers': ['syslog_handlers', ],
            'level': logging.DEBUG,
            'propagate': True,
        },
    }
}

Then you just need to add this:

LOGGING['handlers'] = {
    'syslog_handlers': {
        'formatter': 'syslog',
        'class': 'safe_syslog_handler.handlers.SafeSysLogHandler',
        'socktype': socket.SOCK_STREAM,
        'address': ('localhost', 5140),
    }
}

You can see an example app in the example folder

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

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

safe_syslog_handler-0.2.0.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

safe_syslog_handler-0.2.0-py2.py3-none-any.whl (5.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file safe_syslog_handler-0.2.0.tar.gz.

File metadata

  • Download URL: safe_syslog_handler-0.2.0.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.5.2

File hashes

Hashes for safe_syslog_handler-0.2.0.tar.gz
Algorithm Hash digest
SHA256 23bf0bc23af8dc95d67df17bd160001677ec467d382e84c2039522e2859b3a2a
MD5 c02bbad9bee5befa52547c53c5131183
BLAKE2b-256 cf41aada100dc2b56038ada8d45d6090120270c25a459f6673f23c4b3282beda

See more details on using hashes here.

File details

Details for the file safe_syslog_handler-0.2.0-py2.py3-none-any.whl.

File metadata

  • Download URL: safe_syslog_handler-0.2.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.5.2

File hashes

Hashes for safe_syslog_handler-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 38e1ed024704969880294029ba51bbb687efe383740f073d5bb09ac87b366f6f
MD5 b6376b5bfcd615b022a72fbbcf49d648
BLAKE2b-256 b171482147859b2fa547c69640c9fa655fa0e0d4276f4947d509388d71369182

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