This release is a pre-release and may not be stable for production use.
Socket Log Receiver
socket_log_receiver is a light-weight socket log receiving server.
The server aggregates messages from multi-process applications via a
socket and logs them to a single file. The service is used with
Python's stdlib logging package, which by default does not support
multi-process writes to a single file.
Installation
$ pip install socket-log-receiver
Basic Usage
The receiver service should be run as a service:
$ python -m socket_log_receiver # as a module
$ log_receiver # as a command-line program
These are equivalent.
By default, the receiver service starts listening on localhost:9020.
These can be changed through CLI options; see the Help section below.
In the application, use SocketHandler to send logs to the receiver
service.
from logging.handlers import SocketHandler
handler = SocketHandler('localhost', 9020) # handler to send logs to localhost:9020
logging.root.addHandler(handler) # add the socket handler to the root logger
This way, the root logger sends logging messages to the receiver service.
Help
$ python -m socket_log_receiver -h
$ log_receiver -h
Undefined Signal
The receiver service's configuration is managed by
resconfig. By default, the
dynamic configuration update is trigged by SIGHUP. Some systems
might not make this signal available, in which case you could use a
different signal for the trigger using the command-line option, e.g.
$ log_receiver --reloader-signal SIGUSR2
Development
$ pip install -e .[dev]
$ pre-commit install
Running Tests
$ pip install -e .[test]
$ pytest
Release files for socket-log-receiver 24.3.0b0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| socket-log-receiver-24.3.0b0.tar.gz | 6.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| socket_log_receiver-24.3.0b0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.9 kB
Release files / socket-log-receiver-24.3.0b0.tar.gz
| Download URL | socket-log-receiver-24.3.0b0.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
122adfb8bb40afb03183752ea70b0b66f7a9b4ed0d732f1804a97367c9f2643c
|
|
BLAKE2b-256 checksum How to use checksums |
d028822739f850c9da6de86d4a60f07056146a5a43f54ba89ead18568785eca6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.1
|
Release files / socket_log_receiver-24.3.0b0-py3-none-any.whl
| Download URL | socket_log_receiver-24.3.0b0-py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9aae10c8678a089050f656caf880af10416c5be6a74960f6b0ffacdc86eeb451
|
|
BLAKE2b-256 checksum How to use checksums |
fe82929cca23c1bdbccae83ba2e24e35a303a36284daad661f0b13b0c0b6c4b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.1
|