poltcommunication.blogg.se

Drupal logs
Drupal logs









I downloaded the Examples for Developers module (version 8.x-1.x, but please consult the project page for the latest version) and looked for an example of this in action. \Drupal::logger('my_module')->error($message) There is a straight-up D8 procedural equivalent of D7’s watchdog function, as we learn from the change notice: Drupal 7 watchdog() However, I've left you some hints and pointers at the end of this tutorial if you care to dive in before then.

#DRUPAL LOGS HOW TO#

In a future tutorial, we’ll cover how to create your own logger, and use it in your custom module. In this tutorial, you’ll learn how to create the D8 equivalent of D7’s watchdog() function: creating a log message that appears on the Reports administrative page. In Drupal 8, both functions are replaced by a PSR-3-compatible logging interface ( change notice). Implementing D7’s hook_watchdog allows module developers to customize the destination of these log messages. Additionally the Entity API Hooks tutorial uses logging as an example when working with entities.ĭevelopers familiar with Drupal 7 will also be familiar with watchdog(), an API function that allows you to create a log message that appears on the Reports page in the Drupal administrative UI.

drupal logs

Understand the Service Container and Get a Service from the Container are good places to start with that.

drupal logs

Note: For related topics to this tutorial that you may need to understand, you may be interested in tutorials about using dependency injection, which is needed to get the logger service into your code.









Drupal logs