logs duplicated in stderr because of libais.ais logging handler
aistool
uses lpais
library as a dependency, which uses libais
.
When imported, libais
uses logging
(see ais module) and add a StreamHandler
to the root logger (apparently to deliver a warning message). This handler stays attached to the root logger, which causes logging messages to be duplicated in stderr
or sent to stderr
event if a log file is specified.
In order to fix this the existing handlers have to be removed when invoking the main command (i.e when aistool
is called).
This can be done in aistool/main.py, which is the entry point, after the tasks modules have been loaded:
# import 'tasks'
[...]
def main():
# remove existing handlers attached to root logger here
app.run()