Body: <p>Is it obvious why the task validation errors are not getting output in my log:</p>
  
  <pre><code>public function runStep($step)
  {
      try
      {
          $entry = craft()-&gt;entries-&gt;getEntryById($this-&gt;_entryIds[$step], $this-&gt;_localeId);
  
          if (!$entry)
          {
              return true;
          }
  
          $newExpiryDate = new DateTime($entry-&gt;date);
          $newExpiryDate-&gt;add(new DateInterval('P1D'));
  
  
          // Update Expiry Date
          if($entry-&gt;expiryDate != $newExpiryDate)
          {
              $entry-&gt;expiryDate = $newExpiryDate-&gt;format('Y-m-d');
          }
  
          // Update Status
          $entry-&gt;enabled = true;
  
          // Save Entry
          if(craft()-&gt;entries-&gt;saveEntry($entry))
          {
              return true;    
          }
          else
          {
              $error = 'Encountered the following validation errors when trying to save entry with the ID "'.$entry-&gt;id.'":';
  
              foreach ($entry-&gt;getAllErrors() as $attributeError)
              {
                  $error .= "\n - {$attributeError}";
              }
  
              return $error;              
          }
  
          return true;
      }
      catch (\Exception $e)
      {
          return 'An exception was thrown while trying to save the entry with the ID “'.$this-&gt;_entryIds[$step].'”: '.$e-&gt;getMessage();
      }
  }
  </code></pre>
  
  <p>This task step is based on one of the Craft default steps but the error gets output without the specific validation issues:</p>
  
  <blockquote>
    <p>Encountered an error running task 1191 (Logic_UpdateEvents), step 1 of 1440: Encountered the following validation errors when trying to save entry with the ID "10295":</p>
  </blockquote>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-30T14:52:59.480Z
Comments.Text: What happens if you `Craft::log('error count = '.count($entry->getAllErrors()));`
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-30T14:57:23.573Z
Comments.Text: `error count = 1`
Comments.UserDisplayName: Sam Hibberd
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-30T15:16:44.357Z
Comments.Text: Looks O.K. to me.  What if you do: `Craft::log('error = '.$entry->getAllErrors[0]);`?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-30T15:20:12.217Z
Comments.Text: `Encountered an error running task 1193 (Logic_UpdateEvents), step 1 of 1440: An exception was thrown while trying to save the entry with the ID “10295”: Property "Craft\EntryModel.getAllErrors" is not defined.`
Comments.UserDisplayName: Sam Hibberd
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-30T15:21:17.917Z
Comments.Text: Wait a second surely that needs to be `Craft::log('error = '.$entry->getAllErrors()[0])` ?
Comments.UserDisplayName: Sam Hibberd
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-30T15:22:59.483Z
Comments.Text: That returns the error correctly!
Comments.UserDisplayName: Sam Hibberd
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-30T21:12:33.267Z
Comments.Text: Any idea what caused the issue with the existing code?
Comments.UserDisplayName: Sam Hibberd
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-05-01T07:19:04.003Z
Comments.Text: I've tested a few variations but the line which is pumping out the errors `$error .= "\n - {$attributeError}";` is not happy with \n PHP_EOL, it would be great to know how to get line breaks output into the logs and awesome to get this fixed in the craft core versions.
Comments.UserDisplayName: Sam Hibberd
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-05-01T17:33:58.383Z
Comments.Text: Try using `PHP_EOL` instead of `\n`.
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-05-01T17:34:47.257Z
Comments.Text: Already tried. No go. :(
Comments.UserDisplayName: Sam Hibberd
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-05-13T08:00:32.630Z
Comments.Text: @BradBell Ive discovered that this exact task works as expected when Dev Mode is off! not sure if that helps explain anything??
Comments.UserDisplayName: Sam Hibberd
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-05-13T14:29:42.513Z
Comments.Text: That's really weird!
Comments.UserDisplayName: Brad Bell
Tags: <plugin-development><tasks><debugging>
Title: Debugging Validation Errors In Craft
ThreadText: # Debugging Validation Errors In Craft
  
  (Asked by: username_0 on 2015-04-30)
  
  Is it obvious why the task validation errors are not getting output in my log:
  
  ```
  public function runStep($step)
  {
      try
      {
          $entry = craft()->entries->getEntryById($this->_entryIds[$step], $this->_localeId);
  
          if (!$entry)
          {
              return true;
          }
  
          $newExpiryDate = new DateTime($entry->date);
          $newExpiryDate->add(new DateInterval('P1D'));
  
          // Update Expiry Date
          if($entry->expiryDate != $newExpiryDate)
          {
              $entry->expiryDate = $newExpiryDate->format('Y-m-d');
          }
  
          // Update Status
          $entry->enabled = true;
  
          // Save Entry
          if(craft()->entries->saveEntry($entry))
          {
              return true;    
          }
          else
          {
              $error = 'Encountered the following validation errors when trying to save entry with the ID "'.$entry->id.'":';
  
              foreach ($entry->getAllErrors() as $attributeError)
              {
                  $error .= "\n - {$attributeError}";
              }
  
              return $error;              
          }
  
          return true;
      }
      catch (\Exception $e)
      {
          return 'An exception was thrown while trying to save the entry with the ID “'.$this->_entryIds[$step].'”: '.$e->getMessage();
      }
  }
  
  ```
  
  This task step is based on one of the Craft default steps but the error gets output without the specific validation issues:
  
  > Encountered an error running task 1191 (Logic\_UpdateEvents), step 1 of 1440: Encountered the following validation errors when trying to save entry with the ID "10295":
  
  **Tags:** plugin-development, tasks, debugging
  
  > **Comments:**
  > **username_1**: What happens if you `Craft::log('error count = '.count($entry->getAllErrors()));`  
  > **username_0**: `error count = 1`  
  > **username_1**: Looks O.K. to me.  What if you do: `Craft::log('error = '.$entry->getAllErrors[0]);`?  
  > **username_0**: `Encountered an error running task 1193 (Logic_UpdateEvents), step 1 of 1440: An exception was thrown while trying to save the entry with the ID “10295”: Property "Craft\EntryModel.getAllErrors" is not defined.`  
  > **username_0**: Wait a second surely that needs to be `Craft::log('error = '.$entry->getAllErrors()[0])` ?  
  > **username_0**: That returns the error correctly!  
  > **username_0**: Any idea what caused the issue with the existing code?  
  > **username_0**: I've tested a few variations but the line which is pumping out the errors `$error .= "\n - {$attributeError}";` is not happy with \n PHP_EOL, it would be great to know how to get line breaks output into the logs and awesome to get this fixed in the craft core versions.  
  > **username_1**: Try using `PHP_EOL` instead of `\n`.  
  > **username_0**: Already tried. No go. :(  
  > **username_0**: @username_1 Ive discovered that this exact task works as expected when Dev Mode is off! not sure if that helps explain anything??  
  > **username_1**: That's really weird!  
  
  ---
  
  ## 0 answers
  
  