@@ -8,15 +8,13 @@ if desired. Both Windows and POSIX systems are supported. An optional threaded
8
8
queue logging handler is provided to perform logging in the background.
9
9
10
10
This is a fork of Lowell Alleman's ConcurrentLogHandler 0.9.1 which fixes
11
- a hanging/deadlocking problem. See this:
12
-
13
- https://bugs.launchpad.net/python-concurrent-log-handler/+bug/1265150
11
+ a hanging/deadlocking problem. [ See this] ( https://bugs.launchpad.net/python-concurrent-log-handler/+bug/1265150 ) .
14
12
15
13
Summary of other changes:
16
14
17
15
* New: requires Python 3.6 or higher.
18
- * If you require support for Python 2.7, use version
19
- [ 0.9.22] ( https://github.com/Preston-Landers/concurrent-log-handler/releases/tag/0.9.22 ) .
16
+ * If you require support for Python 2.7, use version
17
+ [ 0.9.22] ( https://github.com/Preston-Landers/concurrent-log-handler/releases/tag/0.9.22 ) .
20
18
* Renamed package to ` concurrent_log_handler ` (abbreviated CLH in this file.)
21
19
* Provide ` use_gzip ` option to compress rotated logs
22
20
* Support for Windows
@@ -46,7 +44,7 @@ However, this is not the only way to achieve shared logging from multiple proces
46
44
centralize logging by using cloud logging services like Azure Log Monitor, Logstash, etc. Or you can
47
45
implement your own remote logging server as shown here:
48
46
49
- https://docs.python.org/3/howto/logging-cookbook.html#sending-and-receiving-logging-events-across-a-network
47
+ [ Logging cookbook: network ] ( https://docs.python.org/3/howto/logging-cookbook.html#sending-and-receiving-logging-events-across-a-network )
50
48
51
49
Concurrent-Log-Handler includes a QueueHandler and QueueListener implementation that can be used to
52
50
perform logging in the background asynchronously, so the thread or process making the log statement doesn't have
@@ -80,31 +78,27 @@ If installing from source, use the following command:
80
78
81
79
If you plan to modify the code, you should follow this procedure:
82
80
83
- - Clone the repository
84
- - Create a virtual environment (` venv ` ) and activate it.
85
- - Install the package in editable mode with the [ dev] option:
86
-
87
- ` pip install -e .[dev] `
88
-
89
- - Run the tests:
81
+ * Clone the repository
82
+ * Create a virtual environment (` venv ` ) and activate it.
83
+ * Install the package in editable mode with the [ dev] option: ` pip install -e .[dev] `
90
84
91
- ` tox ` or run ` pytest ` directly.
85
+ * Run the tests: ` tox ` or run ` pytest ` directly.
92
86
93
87
Or manually run a single pass of the stress test with specific options:
94
88
95
- ```
96
- python tests/stresstest.py --help
97
- python tests/stresstest.py --gzip --num-processes 12 --log-calls=5000
89
+ ``` shell
90
+ python tests/stresstest.py --help
91
+ python tests/stresstest.py --gzip --num-processes 12 --log-calls=5000
98
92
```
99
93
100
- - To build a Python "wheel" for distribution, use the following:
94
+ * To build a Python "wheel" for distribution, use the following:
101
95
102
96
``` shell
103
- python setup.py clean --all build sdist bdist_wheel
104
- # Copy the .whl file from under the "dist" folder
105
- # or upload with twine:
106
- pip install twine
107
- twine upload dist/concurrent-log-handler-0.9.23.tar.gz dist/concurrent_log_handler-0.9.23-py3-none-any.whl
97
+ python setup.py clean --all build sdist bdist_wheel
98
+ # Copy the .whl file from under the "dist" folder
99
+ # or upload with twine:
100
+ pip install twine
101
+ twine upload dist/concurrent-log-handler-0.9.23.tar.gz dist/concurrent_log_handler-0.9.23-py3-none-any.whl
108
102
```
109
103
110
104
### Important Requirements
@@ -122,14 +116,14 @@ these requirements:
122
116
its OWN instance of the handler (` ConcurrentRotatingFileHandler ` ). The child target function
123
117
should call code that initializes a new CLH instance.
124
118
125
- * This requirement does not apply to threads within a given process. Different threads within a
126
- process can use the same CLH instance. Thread locking is handled automatically.
119
+ * This requirement does not apply to threads within a given process. Different threads within a
120
+ process can use the same CLH instance. Thread locking is handled automatically.
127
121
128
- * This also does not apply to ` fork() ` based child processes such as gunicorn --preload.
129
- Child processes of a fork() call should be able to inherit the CLH object instance.
122
+ * This also does not apply to ` fork() ` based child processes such as gunicorn --preload.
123
+ Child processes of a fork() call should be able to inherit the CLH object instance.
130
124
131
- * This limitation exists because the CLH object can't be serialized, passed over a network or
132
- pipe, and reconstituted at the other end.
125
+ * This limitation exists because the CLH object can't be serialized, passed over a network or
126
+ pipe, and reconstituted at the other end.
133
127
134
128
* It is important that every process or thread writing to a given logfile must all use the same
135
129
settings, especially related to file rotation. Also do not attempt to mix different handler
@@ -180,7 +174,7 @@ multiple hosts works due to the use of file locking on the log file. Note that w
180
174
logging feature, currently there is no way for the caller to know when the logging statement
181
175
completed (no "Promise" or "Future" object is returned).
182
176
183
- https://docs.python.org/3/library/logging.handlers.html#queuehandler
177
+ [ QueueHandler ] ( https://docs.python.org/3/library/logging.handlers.html#queuehandler )
184
178
185
179
### Configuration
186
180
@@ -202,7 +196,7 @@ Please note that Python 3.7 and higher accepts keyword arguments (kwargs) in a l
202
196
config file, but earlier versions of Python only accept positional args.
203
197
204
198
Note: you must have an ` import concurrent_log_handler ` before you call fileConfig(). For
205
- more information see http://docs.python.org/lib/logging-config-fileformat.html
199
+ more information see Python docs on [ log file formats ] ( http://docs.python.org/lib/logging-config-fileformat.html )
206
200
207
201
### Limitations
208
202
@@ -237,8 +231,8 @@ order for this to work, each process writing to the log must have access to the
237
231
lock file location, even if they are running on different hosts.
238
232
239
233
You can set the ` namer ` attribute of the handler to customize the naming of the rotated files,
240
- in line with the ` BaseRotatingHandler ` class. See the Python docs for more details:
241
- https://docs.python.org/3.11/library/logging.handlers.html#logging.handlers.BaseRotatingHandler.namer
234
+ in line with the ` BaseRotatingHandler ` class. See the Python docs for
235
+ [ more details ] ( https://docs.python.org/3.11/library/logging.handlers.html#logging.handlers.BaseRotatingHandler.namer ) .
242
236
243
237
### Line Endings
244
238
0 commit comments