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
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.
Free software: Apache Software License 2.0
Documentation: https://safe-syslog-handler.readthedocs.io.
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
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
Built Distribution
Hashes for safe_syslog_handler-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf6e5f872da8880a34d48d19c3f28749fd3cd1e11e4dc9134589b78e269bff53 |
|
MD5 | c9cf3b327f8f7623497077a10d843599 |
|
BLAKE2b-256 | 9b9687e764e2f0a1a923b186997fc9a4164f6c91a853199af426373403fae5ea |
Hashes for safe_syslog_handler-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4515a16ec1a38fae6f109c3666034ee73efe84182739c098088763790a9a5c5 |
|
MD5 | 79545ee3d79194c4ffe3934c931f63ab |
|
BLAKE2b-256 | 11d5f9d70dc9fd42e5345f37ca0f96d4a1011817fcee4d1fb7e024a1d8802155 |