As we know about log messages in Drupal, Log messages are our project related, every user related track (error, notice, warning, failure, PHP issue). In our Drupal we can check that track with URL '/admin/reports/dblog'.
And if we create a custom Module and we want to track every event of module, every time activity that we can write that code in this module.
Logs with an arbitrary level:
\Drupal::logger('module_name')->log($message); //When a module was installed
Normal but significant events:
\Drupal::logger('module_name')->notice($message); //Normals events, as cron execution
Exceptional occurrences:
\Drupal::logger('module_name')->warning($message); //exceptional cases not an error
Errors:
\Drupal::logger('module_name')->error($message); //error messages
And If we have requirement that we want to track this log error message by File,
In that case we have a Drupal 8 module that we can install "File Log" module.
After configure, that file will be Create in root area Bydefault "site/default/files/logs".
I am going to share that module link here.
Note: If have any suggestions or issue regarding 'How to check log error messages in Drupal 8?' then you can ask by comments.
No comments:
Post a Comment