faust
faust copied to clipboard
autodiscover does not actually log errors on discovery
Checklist
- [x] I have included information about relevant versions
- [x] I have verified that the issue persists when using the
master
branch of Faust.
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
- Python version: 3.8.5
- Faust version: 1.10.4
- Operating system: macOS 10.15.6
- Kafka version: N/A
- RocksDB version (if applicable): N/A
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.
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
In my case, logs wouldn't appear because I did not configure Loguru sink. Please, anyone having the same problem, find a reference here