Undesired messages in log : apps log merge
When using IPython, or any other app that use the logging lib, the pyotb logger will also catch other apps logs (fiona, ipython, etc...). This is mostly a probblem when using DEBUG mode. Example when using ipython tab autocomplete:
In [20]: image_di2022-04-20 21:09:36 (DEBUG) [pyOTB] diff parser start
2022-04-20 21:09:36 (DEBUG) [pyOTB] line_lengths old: 1; new: 1
2022-04-20 21:09:36 (DEBUG) [pyOTB] -> code[replace] old[1:1] new[1:1]
2022-04-20 21:09:36 (DEBUG) [pyOTB] parse_part from 1 to 1 (to 0 in part parser)
2022-04-20 21:09:36 (DEBUG) [pyOTB] diff parser end
This is probably due to the logging function used to get a basic logger : logging.getLogger()
.
In fact we use this in order to catch our pyotb logger that was created during init in another module level.
We probably need to get logger by name, in order to avoid catching any other log available in globals (I guess that the problem arise if they use the same function without argument in the other lib).
- TODO: find how to declare a proper logging object, avoid using
getLogger()
without arg - TODO: allow user to change log level or use log file without having to edit lib source code
Edited by Vincent Delbar