osperlabs / logbeam

A python logging handler for CloudWatch Logs
MIT License
11 stars 9 forks source link

When unable to connect to AWS Cloudwatch, AttributeError: 'CloudWatchLogsHandler' object has no attribute 'sink' when shutting down logbeam handler #3

Open terrisgit opened 6 years ago

terrisgit commented 6 years ago

If you create a logbeam logging handler on a machine that has no Internet access, an error like the following occurs while the application closes:

Traceback (most recent call last): File "/usr/local/Cellar/python3/3.6.4_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/usr/local/Cellar/python3/3.6.4_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/Users/terris/science37/edc-export-service/edcexport/main.py", line 16, in EDCExportService().start() File "/Users/terris/science37/edc-export-service/edcexport/edcexport.py", line 75, in start loop.run_forever() File "/usr/local/Cellar/python3/3.6.4_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 421, in run_forever self._run_once() File "/usr/local/Cellar/python3/3.6.4_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 1395, in _run_once event_list = self._selector.select(timeout) File "/usr/local/Cellar/python3/3.6.4_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/selectors.py", line 577, in select kev_list = self._kqueue.control(None, max_ev, timeout) KeyboardInterrupt Error in atexit._run_exitfuncs: Traceback (most recent call last): File "/usr/local/Cellar/python3/3.6.4_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/logging/init.py", line 1944, in shutdown h.close() File "/Users/terris/venv/edc/lib/python3.6/site-packages/logbeam/init.py", line 160, in close self.sink.shutdown() AttributeError: 'CloudWatchLogsHandler' object has no attribute 'sink'