Answers.Body: <p>The good news in the upcoming Craft 3 this isn't an issue.  404's get logged to their own separate log files and won't clutter up the main Craft log files specifically for this reason.</p>
  
  <p>In Craft 2, I think you'd have to do something like write a plugin that listens for Yii's <a href="http://www.yiiframework.com/doc/api/1.1/CApplication#onException-detail" rel="nofollow noreferrer">onException event</a>, makes sure it's a 404 status code, then go through Yii's <a href="http://www.yiiframework.com/doc/guide/1.1/en/topics.logging" rel="nofollow noreferrer">CLogger</a> to get the full list of log entries and remove the last one.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-08T17:43:52.850Z
Answers.Text: Will they still throw an uncaught exception? My main issue is that the 404 exceptions show up in New Relic.
Answers.UserDisplayName: Garrett
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-08T17:49:41.437Z
Answers.Text: It should!  You'd just be listening for all exceptions, checking if the current one is a 404, then if so, modify the logging information.  The request of the exception request would continue as usual.
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-07T23:30:38.513Z
Answers.LastActivityDate: 2016-12-07T23:30:38.513Z
Answers.UserDisplayName: Brad Bell
Body: <p>Requests for non-existent templates/pages (404s) result in an uncaught HttpException.404 being thrown, though the correct 404 template is displayed. Is there some way to suppress or handle this exception? It's flooding my error reporting tool. For reference, here's the stack trace from the log:</p>
  
  <pre><code>2016/12/07 17:29:07 [error] [exception.Craft\HttpException.404] exception 'Craft\HttpException' in /project/craft/app/controllers/TemplatesController.php:59
  Stack trace:
  #0 [internal function]: Craft\TemplatesController-&gt;actionRender('page-no-existy', Array)
  #1 /project/craft/app/framework/web/actions/CAction.php(109): ReflectionMethod-&gt;invokeArgs(Object(Craft\TemplatesController), Array)
  #2 /project/craft/app/framework/web/actions/CInlineAction.php(47): CAction-&gt;runWithParamsInternal(Object(Craft\TemplatesController), Object(ReflectionMethod), Array)
  #3 /project/craft/app/framework/web/CController.php(308): CInlineAction-&gt;runWithParams(Array)
  #4 /project/craft/app/framework/web/CController.php(286): CController-&gt;runAction(Object(CInlineAction))
  #5 /project/craft/app/framework/web/CController.php(265): CController-&gt;runActionWithFilters(Object(CInlineAction), Array)
  #6 /project/craft/app/framework/web/CWebApplication.php(282): CController-&gt;run('render')
  #7 /project/craft/app/framework/web/CWebApplication.php(141): CWebApplication-&gt;runController('templates/rende...')
  #8 /project/craft/app/etc/web/WebApp.php(290): CWebApplication-&gt;processRequest()
  #9 /project/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&gt;processRequest()
  #10 /project/craft/app/index.php(62): CApplication-&gt;run()
  #11 /project/src/static/index.php(21): require_once('/project...')
  #12 {main}
  REQUEST_URI=/page-no-existy
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-08T17:47:38.153Z
Comments.Text: As a workaround, I just told New Relic to ignore these exceptions. In the appropriate `newrelic.ini` for your version of PHP, add `newrelic.error_collector.ignore_exceptions = "Craft\HttpException"`
Comments.UserDisplayName: Garrett
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-10-16T14:14:36.500Z
Comments.Text: This is driving us crazy as well. By adding this exception, it seems like you would lose reporting on _any_ HttpException though, can you confirm @garrett?
Comments.UserDisplayName: tekstrand
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-10-17T22:50:58.287Z
Comments.Text: @TheEks yes, any exception that is an instance of `Craft\HttpException`. I've since stopped using New Relic, so I can't comment on whether this is still a good idea (if it ever was!).
Comments.UserDisplayName: Garrett
Tags: <templating><error-templates>
Title: Suppress HttpException.404 for bad URLs
ThreadText: # Suppress HttpException.404 for bad URLs
  
  (Asked by: username_0 on 2016-12-07)
  
  Requests for non-existent templates/pages (404s) result in an uncaught HttpException.404 being thrown, though the correct 404 template is displayed. Is there some way to suppress or handle this exception? It's flooding my error reporting tool. For reference, here's the stack trace from the log:
  
  ```
  2016/12/07 17:29:07 [error] [exception.Craft\HttpException.404] exception 'Craft\HttpException' in /project/craft/app/controllers/TemplatesController.php:59
  Stack trace:
  #0 [internal function]: Craft\TemplatesController->actionRender('page-no-existy', Array)
  #1 /project/craft/app/framework/web/actions/CAction.php(109): ReflectionMethod->invokeArgs(Object(Craft\TemplatesController), Array)
  #2 /project/craft/app/framework/web/actions/CInlineAction.php(47): CAction->runWithParamsInternal(Object(Craft\TemplatesController), Object(ReflectionMethod), Array)
  #3 /project/craft/app/framework/web/CController.php(308): CInlineAction->runWithParams(Array)
  #4 /project/craft/app/framework/web/CController.php(286): CController->runAction(Object(CInlineAction))
  #5 /project/craft/app/framework/web/CController.php(265): CController->runActionWithFilters(Object(CInlineAction), Array)
  #6 /project/craft/app/framework/web/CWebApplication.php(282): CController->run('render')
  #7 /project/craft/app/framework/web/CWebApplication.php(141): CWebApplication->runController('templates/rende...')
  #8 /project/craft/app/etc/web/WebApp.php(290): CWebApplication->processRequest()
  #9 /project/craft/app/framework/base/CApplication.php(185): Craft\WebApp->processRequest()
  #10 /project/craft/app/index.php(62): CApplication->run()
  #11 /project/src/static/index.php(21): require_once('/project...')
  #12 {main}
  REQUEST_URI=/page-no-existy
  
  ```
  
  **Tags:** templating, error-templates
  
  > **Comments:**
  > **username_0**: As a workaround, I just told New Relic to ignore these exceptions. In the appropriate `newrelic.ini` for your version of PHP, add `newrelic.error_collector.ignore_exceptions = "Craft\HttpException"`  
  > **username_1**: This is driving us crazy as well. By adding this exception, it seems like you would lose reporting on _any_ HttpException though, can you confirm @username_0?  
  > **username_0**: @TheEks yes, any exception that is an instance of `Craft\HttpException`. I've since stopped using New Relic, so I can't comment on whether this is still a good idea (if it ever was!).  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2016-12-07. Score: 1 | Accepted answer
  
  The good news in the upcoming Craft 3 this isn't an issue. 404's get logged to their own separate log files and won't clutter up the main Craft log files specifically for this reason.
  
  In Craft 2, I think you'd have to do something like write a plugin that listens for Yii's [onException event](http://www.yiiframework.com/doc/api/1.1/CApplication#onException-detail), makes sure it's a 404 status code, then go through Yii's [CLogger](http://www.yiiframework.com/doc/guide/1.1/en/topics.logging) to get the full list of log entries and remove the last one.
  
  > **Comments:**
  > **username_0**: Will they still throw an uncaught exception? My main issue is that the 404 exceptions show up in New Relic.  
  > **username_2**: It should!  You'd just be listening for all exceptions, checking if the current one is a 404, then if so, modify the logging information.  The request of the exception request would continue as usual.  
  
  ---
  
  