dpoppu4300 2016-06-15 06:22
浏览 88

我怎么能检查drupal日志

The problem is that mailing on my site didt work. There is code to sending mail

....

$params['subject'] = $mail_subject;
    $params['body'] = $mail_body;
    $to = 'dmitriikotow@gmail.com'
    $from = 'mail@ckeverest.ru';
    $lang = language_default();

drupal_mail('everest_mail', 'html_mail', $to, $lang, $params, $from, false);

....

There is custom mail-module code

<?php

class EverestMailSystem extends DefaultMailSystem {
  public function format(array $message) {
    $message['body'] = implode("

", $message['body']);
    $message['body'] = drupal_wrap_mail($message['body']);
    return $message;
  }
}

function everest_mail_mail($key, &$message, $params) {
  switch ($key) {
    case 'html_mail':
      $message['headers']['Content-Type'] = 'text/html; charset=UTF-8;';
      $message['subject'] = $params['subject'];
      $message['body'][] = $params['body'];
      break;
  }
}

?>

At first glance, everything should work. There is a suspicion that the problem is outside of the module, as sending messages to work until the last update the appearance of the site (I have not participated in the update). As the module was not written by me, so I need the opinion of a more experienced programmer than I am.

In any case, I would like to know. Where can I find useful in my case the logs site? And with their help to catch a mistake?

Thank you so much.

  • 写回答

1条回答 默认 最新

  • drgawfsf1069 2016-06-15 13:24
    关注

    Drupal uses a module called watchdog to handle logging (D8 and earlier). There are a few ways to access these logs:

    • If you are using Drush, you can simply type drush ws to see a list of the most recent 10(ish) log entries. (pro tip: each log entry has an id and if you type drush ws [ID] you can see more details)
    • There is a module that ships with Drupal called "Database logs" or "DB Logs". If you enable this module you will get a "view recent log messages" page under the "report" menu item. DO NOT enable this module on a production site except as an absolute last resort.
    • I'm 99% sure that Drupal's watchdog logs are piped into you system log so you should be able to get them in there as well. In OSX (ahem) MacOS you can use the Console Application to view logs, or just use tail on the command line to tail your system logs

    hope that helps

    评论

报告相同问题?