Hi! I was wondering how can you make dagster captu...
# announcements
c
Hi! I was wondering how can you make dagster capture the logs of modules used inside solids that may not have direct access to the logging module. So for example if I have a module
Copy code
import logging
logger = logging.get_logger(__name__)

class Processor:
    def process(self):
        logger.log("processing...")
I could see this log in the dagster execution logs when used in a solid
Copy code
@solid
def main_process():
    processor = Processor()
    processor.process()
Currently I'd pass the context logger directly to the object, but I was wondering wether there could be a better approach.
p
Hi David. Do you need the logs to be visible in the structured runs view? We also have the raw step output logs (or compute logs) that capture the stdout/stderr for each compute step.
c
Yes, ideally in the structured runs view. Also, can one access the compute logs from within the dagit interface?
Also Hi!
p
Yes, there should be a link in the logs labeled
View Raw Step Output
for events of the type
Step Start
You can also click on an individual step in the waterfall view, and there should be a button on the log filter bar
c
pretty nice, did not notice that. Thanks
p
Yeah, the best way to produce structured logs is to pass the context logger through
c
In case we wanted them in the structured logs, the only solution would be to pass the
context.log
from the solid to the object?
p
that’s right… there has to be some way for you to call from your code into the dagster logging framework
m
we do also have this longstanding issue: https://github.com/dagster-io/dagster/issues/1643
c
oh I see 🤔
m
feel free to weigh in on the issue if this is something that would make your life easier
c
Thanks, configuration using the standard logging module would be ideal but we can manage having the raw output as of now.