Answers.Body: <p>Craft goes with Yii 2's defaults in the FileTarget class, which is 10MB for a log file before rotating. <a href="https://www.yiiframework.com/doc/api/2.0/yii-log-filetarget#" rel="nofollow noreferrer">https://www.yiiframework.com/doc/api/2.0/yii-log-filetarget#</a>$maxFileSize-detail</p>
  
  <p>You can overwrite that behavior from your <code>config/app.php</code> file by using something like:</p>
  
  <pre><code>'components' =&gt; [
          'log' =&gt; function() {
              $log = Craft::createObject([
                  'class' =&gt; yii\log\Dispatcher::class,
                  'targets' =&gt; [
                      [
                          'class' =&gt; craft\log\FileTarget::class,
                          'levels' =&gt; !YII_DEBUG ? yii\log\Logger::LEVEL_ERROR | yii\log\Logger::LEVEL_WARNING : yii\log\Logger::LEVEL_ERROR | yii\log\Logger::LEVEL_WARNING | yii\log\Logger::LEVEL_INFO | yii\log\Logger::LEVEL_TRACE | yii\log\Logger::LEVEL_PROFILE,
                          'maxFileSize' =&gt; 5120, // 5MB
                      ],
                  ],
              ]);
  
              return $log;
          },
      ],
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-10-22T08:55:08.567Z
Answers.Text: Great - many thanks for this info. Is it possible to disable the 404 logging altogether?
Answers.UserDisplayName: Janine
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-10-22T17:16:30.193Z
Answers.Text: A plugin/module that used it's own ErrorHandler or FileTarget class could get away with it.
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-10-20T02:43:51.953Z
Answers.LastActivityDate: 2018-10-20T02:43:51.953Z
Answers.UserDisplayName: Brad Bell
Body: <p>I've noticed that Craft 3 log files in storage/logs e.g. web-404s.log and web.log don't seem to have a max size or rotate like with Craft 2.</p>
  
  <p>The web-404s.log file is nearly 10 megs for 1 site now.</p>
  
  <p>Should the log files continually grow like this or is there just an issue with my setup?</p>
  
  <p>Are there config settings to set the max log file size or disable certain logging that I'm missing?</p>
  
  <p>Thanks</p>
  
Tags: <craft3><config><logs>
Title: Craft 3 large log file sizes
ThreadText: # Craft 3 large log file sizes
  
  (Asked by: username_0 on 2018-10-16)
  
  I've noticed that Craft 3 log files in storage/logs e.g. web-404s.log and web.log don't seem to have a max size or rotate like with Craft 2.
  
  The web-404s.log file is nearly 10 megs for 1 site now.
  
  Should the log files continually grow like this or is there just an issue with my setup?
  
  Are there config settings to set the max log file size or disable certain logging that I'm missing?
  
  Thanks
  
  **Tags:** craft3, config, logs
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-10-20. Score: 1 | Accepted answer
  
  Craft goes with Yii 2's defaults in the FileTarget class, which is 10MB for a log file before rotating. <https://www.yiiframework.com/doc/api/2.0/yii-log-filetarget#>$maxFileSize-detail
  
  You can overwrite that behavior from your `config/app.php` file by using something like:
  
  ```
  'components' => [
          'log' => function() {
              $log = Craft::createObject([
                  'class' => yii\log\Dispatcher::class,
                  'targets' => [
                      [
                          'class' => craft\log\FileTarget::class,
                          'levels' => !YII_DEBUG ? yii\log\Logger::LEVEL_ERROR | yii\log\Logger::LEVEL_WARNING : yii\log\Logger::LEVEL_ERROR | yii\log\Logger::LEVEL_WARNING | yii\log\Logger::LEVEL_INFO | yii\log\Logger::LEVEL_TRACE | yii\log\Logger::LEVEL_PROFILE,
                          'maxFileSize' => 5120, // 5MB
                      ],
                  ],
              ]);
  
              return $log;
          },
      ],
  
  ```
  
  > **Comments:**
  > **username_0**: Great - many thanks for this info. Is it possible to disable the 404 logging altogether?  
  > **username_1**: A plugin/module that used it's own ErrorHandler or FileTarget class could get away with it.  
  
  ---
  
  