5

I can create log messages really easily in Drupal 9.x like this;

\Drupal::logger('mymodule')->error("something went wrong");

I see these messages appear in /admin/reports/dblog, but it would be convenient if I had the option to print them to stdout, or perhaps a file that I could tail. Is this possible?

Note that this question looks similar but I think it's for an older version of drupal using watchdog, so I don't think it applies: how to show admin/reports/dblog in terminal ( cli )

1 Answer 1

6

I’ve been using the log_stdout module for stdout logging. It works well with Docker containers.

This module provides a hook for Drupal Watchdog that directs log messages to php://stdout or php://stderr for better log handling with Docker.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.