File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -30,3 +30,20 @@ logger.setLevel(logging.DEBUG)
3030
3131logger.info(' Happy Logging!' )
3232```
33+
34+ Troubleshooting
35+ ----------
36+
37+ If you see the following error when running on macOS:
38+
39+ ```
40+ Traceback (most recent call last):
41+ File "/path/to/kafka-logging-handler/kafka_logger/handlers.py", line 109, in __init__
42+ 'host_ip': socket.gethostbyname(socket.gethostname())
43+ socket.gaierror: [Errno 8] nodename nor servname provided, or not known
44+ ```
45+
46+ The issues is that ` socket.gethostname() ` resolves to a name that is not available in ` /etc/hosts ` .
47+ First run ` python3 -c "import socket; print(socket.gethostname())" ` to get the name (e.g. ` MacBook-Pro ` ).
48+ Then fix it with ` sudo echo 127.0.0.1 MacBook-Pro >> /etc/hosts ` , where ` MacBook-Pro ` is your computer name.
49+ There won't be OS-specific fix for it in the library.
Original file line number Diff line number Diff line change @@ -299,7 +299,7 @@ def at_exit(self):
299299 "main process termination. This may cause logs loss." ,
300300 len (children ),
301301 )
302- while self .mp_log_queue .qsize () != 0 :
302+ while not self .mp_log_queue .empty () :
303303 time .sleep (KafkaLoggingHandler .__MULTIPROCESSING_QUEUE_FLUSH_DELAY )
304304 # wait until everything in multiprocessing queue will be buffered
305305 self .mp_log_handler_flush_lock .acquire ()
You can’t perform that action at this time.
0 commit comments