0

Is there a way to stop or reduce logging?

You can either

  • limit all application logging to certain level (DEBUG, INFO, WARNING, ...) - that's to broad and not suitable
  • limit concrete connexion loggers (ie. connexion.operations.abstract) to certein level - that's too narrow and connexion has lot of different loggers, which can be good for development of connexion itself, but is nuisance otherways
    • this way I've managed to create list of many connexion.* loggers and reduce logging to some amount (using structlog.get_logger(logger_name).setLevel(logging.WARNING)), but there are still some huge logs on DEBUG level that starts with
      • Attaching x-scope to {
      • Ref #/components/
      • Dereferencing {

Is there some way to get rid of these logs? Or even better select logger via wildcard somehow? ie connexion.*?

Thanks for answer.

Michal

PS: Asked same question on Connexion Github: https://github.com/zalando/connexion/issues/1417

Michal Vašut
  • 187
  • 2
  • 8

1 Answers1

0

AFAIK connexion doesn't use structlog so setting the level on concrete loggers won't do you much good.

You're gonna have to use stdlib's global configuration. Something like:

[loggers]
keys = root, connexion, ...

[handlers]
keys = console

[formatters]
keys = generic

[handler_console]
class = StreamHandler
args = (sys.stdout,)
level = NOTSET
formatter = generic

[formatter_generic]
format = %(message)s

[logger_root]
level = INFO
handlers = console

[logger_connexion]
level = WARN
handlers =
qualname = connexion

Which you then load using logging.config.fileConfig()

hynek
  • 3,647
  • 1
  • 18
  • 26