Hi I was wondering if someone can help me with a p...
# prefect-community
r
Hi I was wondering if someone can help me with a prefect logging question. I've got logs working and have configured an additional logger using config.toml 1. How do I suppress prefect logs to say WARN level and have mine at INFO level? right now the logging level controls all logs 2. I currently have a weird behaviour where I see some other logging logging statements of mine: notice the duplication - i didnt specify the formatting for the 2nd bottom log
[2020-10-02 14:32:01] INFO - (13104) task_runner.run | Task 'calculate_payoffs': finished task run for task with final state: 'Success'
INFO:prefect.TaskRunner:Task 'calculate_payoffs': finished task run for task with final state: 'Success'
d
Hi @Ralph Willgoss, https://docs.prefect.io/core/concepts/logging.html#logging-configuration According to the above, it should only affect “Prefect” loggers.
Prefect’s logger can be configured to log from stdout. If your logger is writing to there, perhaps that’s where the duplication comes from
r
thanks guys much appreciated i cannot work out who the second logger is whats the best way to do that?
d
That’s going to be hard to determine without taking a look at your flow
Do you feel comfortable sharing?
r
i am using the LocalDaskExecutor - would that make any difference?
d
Maybe? Dask does have an internal logger I think
But I’ve used our Dask tools and I haven’t encountered that issue
r
ok - im going to code up a demo, and re produce the behaviour. then i can share
d
👍
r
what is the default logger that prefect uses, its it just called "logger" as per the docs?
d
prefect.utilities.logging.get_logger(<optional name>)
Yes, that one 👍
r
ah but if your in a task i dont think the name is optional?
d
I believe it is
r
when you say it should only affect prefect loggers, if I configure my logger in the extra_loggers part - is it now considered a prefect logger? i want to suppress all prefect logs and just emit my logs
@Dylan this might be an answer re adding loggers "you can provide these extra loggers to have them inherit the Prefect logging config" I read this as your loggers inherit the settings. So therefore you inherit the LEVEL as well
d
Ahh yes, I believe it is
Can I ask why you’d like to turn off all of the Prefect logs?
r
@Dylan i would like to filter out prefects INFO level logs as they are noisy and don't add any value to me. I want the ERROR, WARN etc I would like my own logger to log at INFO level. It appears as though you cannot have this type of granularity though.