ocrd_utils.logging module

Logging setup

By default: Log with lastResort logger, usually STDERR.

Logging can be overridden either programmatically in code using the library or by creating one or more of

  • /etc/ocrd_logging.py

  • $HOME/ocrd_logging.py

  • $PWD/ocrd_logging.py

These files will be executed in the context of ocrd/ocrd_logging.py, with logging global set.


Get (string) python logging level for (string) spec-defined log level name.

ocrd_utils.logging.getLogger(*args, **kwargs)[source]

Wrapper around logging.getLogger that respects overrideLogLevel.


Reset root logger, read logging configuration if exists, otherwise use basicConfig

ocrd_utils.logging.setOverrideLogLevel(lvl, silent=False)[source]

Override all logger filter levels to include lvl and above.

  • Set root logger level

  • iterates all existing loggers and sets their log level to NOTSET.

  • lvl (string) – Log level name.

  • silent (boolean) – Whether to log the override call