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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23bf0bc23af8dc95d67df17bd160001677ec467d382e84c2039522e2859b3a2a
|
|
| MD5 |
c02bbad9bee5befa52547c53c5131183
|
|
| BLAKE2b-256 |
cf41aada100dc2b56038ada8d45d6090120270c25a459f6673f23c4b3282beda
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38e1ed024704969880294029ba51bbb687efe383740f073d5bb09ac87b366f6f
|
|
| MD5 |
b6376b5bfcd615b022a72fbbcf49d648
|
|
| BLAKE2b-256 |
b171482147859b2fa547c69640c9fa655fa0e0d4276f4947d509388d71369182
|