processing with --log-level override does not apply anymore
Closed this issue · 4 comments
It seems that with 2696705 we lost the ability to control all loggers at once from the CLI.
@kba you commented
Changes as of 2023-08-20:
- Try to be less intrusive with OCR-D specific logging conventions to
make it easier and less surprising to define logging behavior when
using OCR-D/core as a library- Change setOverrideLogLevel to only override the log level of the
ocrd
logger and its descendants- initLogging will set exactly one handler, for the root logger or for the
ocrd
logger.- Child loggers should propagate to the ancestor logging (default
behavior of the logging library - no more PropagationShyLogger)- disableLogging only removes any handlers from the
ocrd
logger
But how did you intend to effect that all loggers (e.g. processor.Tesserocr
) are inheriting from ocrd
?
More explanation on #1080:
Until now, we implemented --log-level/setOverrideLoglevel by changing the default logger to one that does not propagate and overriding the levels of every logger. Now, we keep the default behavior (all loggers propagate) and only change the level of the ocrd logger. We leave the root logger alone completely.
Again, I don't quite get it. How can this work with all the loggers we use in the wild, the least of which actually derive from ocrd
? (For example, we have ocrd_network.*
and processor.*
...)
So perhaps as a workaround we could move the other loggers under ocrd
(i.e. ocrd.ocrd_network.*
, ocrd.processor.*
etc.). But what about other loggers we wanted to affect in ocrd_logging.conf (e.g. shapely
, PIL
or tensorflow
)?
Also, it seems that the log config file (e.g. ~/ocrd_logging.conf
) still takes precedence: If I run ocrd-tesserocr-recognize with --log-level ERROR
I can still see ocrd.workspace.save_image_file
messages with INFO
level...