robinhood / faust

Python Stream Processing
Other
6.75k stars 534 forks source link

autodiscover does not actually log errors on discovery #649

Open jmaroeder opened 4 years ago

jmaroeder commented 4 years ago

Checklist

Steps to reproduce

# proj/app.py
import faust

app = faust.App(
    'proj',
    version=1,
    autodiscover=['proj.users'],
    origin='proj'   # imported name for this project (import proj -> "proj")
)
# proj/users.py
raise ImportError()

Expected behavior

A "WARNING" level log message along the lines of Autodiscovery importing module %r raised error: %r, as indicated in https://github.com/robinhood/faust/blob/master/faust/app/base.py#L724

Actual behavior

Silence/no errors - because the logger hasn't been set up yet.

If I set up a logger before calling app.main(), then I can see the WARNING messages, but if I rely on faust to set them up, these messages are swallowed

Versions

caffeinatedgaze commented 2 years ago

Could you clarify what you meant by setting up a logger? Thank you for this description. @jmaroeder

I am having the same problem right now, I tried wrapping imports into try ... except statements but it does not always help.

jmaroeder commented 2 years ago

Could you clarify what you meant by setting up a logger? Thank you for this description. @jmaroeder

Using something like logging.basicConfig, if I remember correctly

caffeinatedgaze commented 2 years ago

In my case, logs wouldn't appear because I did not configure Loguru sink. Please, anyone having the same problem, find a reference here