<p>Those should not be logged in <code>web.log</code> when running Craft 3.x, but rather in the <code>web404s.log</code> -- assuming you don't have <code>devMode</code> on (which it shouldn't be on for production...)</p>

<p>Vide: <a href="https://nystudio107.com/blog/zen-and-the-art-of-craft-cms-log-file-reading" rel="nofollow noreferrer">Zen and the Art of Craft CMS Log File Reading</a></p>

<p>Also should you really want to customize things, it's not hard to do with Craft CMS, check out: <a href="https://nystudio107.com/blog/creating-a-custom-logger-for-craft-cms" rel="nofollow noreferrer">Creating a Custom Logger for Craft CMS</a></p>

CC BY-SA 4.0
2019-11-19T20:57:25.083Z
I don't have devMode on, but I have changed to a the streamlog, but don't understand why that would enable it? I just can't have a file since I'm running in AWS ECS as a container. But I assume I could add an `except` config somehow to remove the `yii\web\HttpException:404` namespace?
jishi
CC BY-SA 4.0
2019-11-21T18:24:54.247Z
I added a section on **Monolog as a Logger** that I think answers what you're trying to do here: [Creating a Custom Logger for Craft CMS](https://nystudio107.com/blog/creating-a-custom-logger-for-craft-cms#monolog-as-a-logger) (see the `'except'` key/value)
andrew.welch
CC BY-SA 4.0
2019-11-21T23:40:30.063Z
Nice, Monolog seems like a more versatile setup than yii2-streamlog.
jishi
CC BY-SA 4.0
2019-11-19T19:14:00.510Z
2019-11-19T19:14:00.510Z
andrew.welch
<p>I'm getting a lot of noise in the logs from requests that are auto generated from browsers and spiders (like favico.ico, robots.txt, /home /news etc) that doesn't actually have any endpoints. </p>

<p>These get caught by index.php and throws </p>

<pre><code>[yii\web\HttpException:404] yii\web\NotFoundHttpException: Template not found: new in /app/vendor/craftcms/cms/src/controllers/TemplatesController.php:93"
</code></pre>

<p>Which is causing a tremendous amount of noise. I would never consider a 404 a real error, so I would like to not log this at all in Craft (I can use access log aggregation for this). </p>

<p>However, I'm not sure how to go about it. I have already created a custom log component, to remove the logging of all server variables on error, and send outputs to stderr (because of docker), with <code>yii2-streamlog</code>.</p>

<p>My log config is as follows:</p>

<pre><code>    'components' =&gt; [
        'log' =&gt; function() {
            return Craft::createObject([
                'class' =&gt; yii\log\Dispatcher::class,
                'targets' =&gt; [
                    [
                        'class' =&gt; codemix\streamlog\Target::class,
                        'url' =&gt; 'php://stderr',
                        'levels' =&gt; Logger::LEVEL_ERROR | Logger::LEVEL_WARNING,
                        'logVars' =&gt; []
                    ],

                ]
            ]);
        }
    ],
</code></pre>

CC BY-SA 4.0
2019-11-19T21:18:55.273Z
Seems like adding a
`'except' => ['yii\web\HttpException:404']`
to the target removes it from my streamlog
jishi
<logging>
Mute NotFoundHttpException from logs
# Mute NotFoundHttpException from logs

(Asked by: username_0 on 2019-11-19)

I'm getting a lot of noise in the logs from requests that are auto generated from browsers and spiders (like favico.ico, robots.txt, /home /news etc) that doesn't actually have any endpoints. 
These get caught by index.php and throws 
[yii\web\HttpException:404] yii\web\NotFoundHttpException: Template not found: new in /app/vendor/craftcms/cms/src/controllers/TemplatesController.php:93"

Which is causing a tremendous amount of noise. I would never consider a 404 a real error, so I would like to not log this at all in Craft (I can use access log aggregation for this). 
However, I'm not sure how to go about it. I have already created a custom log component, to remove the logging of all server variables on error, and send outputs to stderr (because of docker), with yii2-streamlog.
My log config is as follows:
    'components' => [
        'log' => function() {
            return Craft::createObject([
                'class' => yii\log\Dispatcher::class,
                'targets' => [
                    [
                        'class' => codemix\streamlog\Target::class,
                        'url' => 'php://stderr',
                        'levels' => Logger::LEVEL_ERROR | Logger::LEVEL_WARNING,
                        'logVars' => []
                    ],

                ]
            ]);
        }
    ],

**Tags:** logging
> **Comments:**
> **username_0**: Seems like adding a `'except' => ['yii\web\HttpException:404']` to the target removes it from my streamlog  

---

## 1 answers

### Answer by username_1 on 2019-11-19. Score: 2

Those should not be logged in `web.log` when running Craft 3.x, but rather in the `web404s.log` -- assuming you don't have `devMode` on (which it shouldn't be on for production...)

Vide: [Zen and the Art of Craft CMS Log File Reading](https://nystudio107.com/blog/zen-and-the-art-of-craft-cms-log-file-reading)

Also should you really want to customize things, it's not hard to do with Craft CMS, check out: [Creating a Custom Logger for Craft CMS](https://nystudio107.com/blog/creating-a-custom-logger-for-craft-cms)

> **Comments:**
> **username_0**: I don't have devMode on, but I have changed to a the streamlog, but don't understand why that would enable it? I just can't have a file since I'm running in AWS ECS as a container. But I assume I could add an `except` config somehow to remove the `yii\web\HttpException:404` namespace?  
> **username_1**: I added a section on **Monolog as a Logger** that I think answers what you're trying to do here: [Creating a Custom Logger for Craft CMS](https://nystudio107.com/blog/creating-a-custom-logger-for-craft-cms#monolog-as-a-logger) (see the `'except'` key/value)  
> **username_0**: Nice, Monolog seems like a more versatile setup than yii2-streamlog.  

---

