I am trying to use <caplog> in pytest to capture l...
# ask-community
m
I am trying to use caplog in pytest to capture logs when unit testing my IO manager but the caplog doesn't show anything from dagster (only vanilla python logging output) I tried using:
Copy code
with caplog.at_level(logging.DEBUG, logger="dagster.builtin"):
    manager.handle_output(context, obj)
...
But that doesn't capture anything. Is there something I am doing wrong / is there a way to inspect the dagster logs so I can assert some messages being logged?
o
hi @martin o leary -- I think using capsys and examining the stderr stream will yield better results here. You'll only get log messages flowing through the standard python logging stream when using
get_dagster_logger()
(this is circumvented when using
context.log()
)
🙌 1
m
Brilliant @owen that did it thanks!!