Skip to content

Instantly share code, notes, and snippets.

@b-durand
Forked from anonymous/sample1.txt
Created July 5, 2012 19:48
Show Gist options
  • Save b-durand/3056000 to your computer and use it in GitHub Desktop.
Save b-durand/3056000 to your computer and use it in GitHub Desktop.
email log sample code
application.ini
resources.log.stream.writerName = "Mail"
resources.log.stream.writerParams.subjectPrependText = "website ERROR: "
resources.log.stream.writerParams.email = "info@example.com"
resources.log.stream.writerParams.replyto = "info@example.com"
resources.log.stream.writerParams.to = "me@example.com"
ErrorController.php
// Log exception, if logger available
if ($log = $this->getLog()) {
$log->log($this->view->message, $priority, $errors->exception);
$log->log('Request Parameters', $priority, $errors->request->getParams());
}
Email Content
2012-07-05T13:47:49-05:00 NOTICE (5): Page not found
2012-07-05T13:47:49-05:00 NOTICE (5): Request Parameters
@b-durand
Copy link
Author

b-durand commented Jul 5, 2012

ErrorController.php
// Log exception, if logger available
if ($log = $this->getLog()) {
$log->log($this->view->message, $priority, $errors->exception);
$log->log('Request Parameters', $priority, $errors->request->getParams());
}

=> see http://framework.zend.com/issues/browse/ZF-10427

The tips to solve this issue without patch the library is:
ErrorController.php
// Log exception, if logger available
if ($log = $this->getLog()) {
$log->log($this->view->message . ': ' . $errors->exception, $priority);
$log->log('Request Parameters: ' . var_export($errors->request->getParams(), true), $priority);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment