-
Notifications
You must be signed in to change notification settings - Fork 89
Duplicate logs when using coloredlogs #310
Comments
Kopf injects its own logger in The easiest way would be to define your Another way would be not to use import kopf
@kopf.on.event(...)
def fn(...): ...
def main():
# setup your logging here
kopf.run(
standalone=...,
namespace=...,
priority=...,
peering_name=...,
liveness_endpoint=...,
) Also see: embedding the operators if you want something even more advanced. And yet another way would be adding a CLI option to Kopf itself, handled somewhere around these lines: https://github.com/zalando-incubator/kopf/blob/0.25/kopf/cli.py#L24-L34. And then, (re-)configuring your own logging on the module level statements or in E.g. See this diff for ideas (it was my experimentation branch — just ignore the part with JSON, look only at PLAIN/FULL formats). |
Question
I'm using the
coloredlogs
library to format my log output. When it's enabled, I end up getting duplicate logs: one line from kopf's logging handler and one from the coloredlogs handler I configured.Is there a way to get kopf to piggyback on my existing coloredlogs setup? (I imagine this would work for any existing Python logging setup, not just mine.)
Checklist
Keywords
duplicate logs
coloredlogs
The text was updated successfully, but these errors were encountered: