How to Log Messages in Drupal 8

Опубликовано: 23 Март 2026
на канале: Drupal Up - Drupal 8 Video Tutorials
3,167
28

In this video, we are going to show how to log messages with our custom module.

If you liked this video, please also have a look at my new course about Drupal 8 module development here (with 50% discount):
https://goo.gl/LPyeDw

We are going to learn where are all the Drupal logs in our system. What types of messages exist and how to log the different types of messages.

We are also going to create a custom module, with the help of which we are going to log messages as a new node is created. For that, we are going to be using the hook_entity_insert function in our .module file.

Here is the video on how to inject a service into another service:
   • 🛠 Drupal 8 injecting a service to our cust...  

Drupal.org on the Logging API + example how to inject the logging service into another service:
https://www.drupal.org/docs/8/api/log...

Here is a video on how to inject a service into a custom form:
   • Custom form with our Fibonacci service (WA...  

The full code of the module you may find here:
https://github.com/drupal-up/drupalup...

More videos and stuff you may find on http://drupal-up.com

To support us please, don't forget to share, subscribe, like and comment on the video!