From b5ccf3bc044878837cd253debaa820420807a58d Mon Sep 17 00:00:00 2001
From: Carsten Brandt <mail@cebe.cc>
Date: Fri, 27 Jun 2014 14:53:08 +0200
Subject: [PATCH] changed default for rotateByCopy of FileTarget

works on windows out of the box now.
fixes #3989
---
 framework/CHANGELOG.md       |  1 +
 framework/log/FileTarget.php | 16 +++++++++-------
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md
index 4db4877..4d9bb16 100644
--- a/framework/CHANGELOG.md
+++ b/framework/CHANGELOG.md
@@ -150,6 +150,7 @@ Yii Framework 2 Change Log
 - Chg #3897: Raised visibility of `yii\web\View::registerAssetFiles()` to protected (samdark)
 - Chg #3899: Moved `MailEvent` class to `yii\mail` namespace (cebe)
 - Chg #3956: Flash messages set via `Yii::$app->session->setFlash()` will be removed only if they are accessed (qiangxue)
+- Chg #3989: The default value for `yii\log\FileTarget::$rotateByCopy` now defaults to true to work on windows by default (cebe)
 - Chg #4071: `mail` component renamed to `mailer`, `yii\log\EmailTarget::$mail` renamed to `yii\log\EmailTarget::$mailer` (samdark)
 - Chg: Replaced `clearAll()` and `clearAllAssignments()` in `yii\rbac\ManagerInterface` with `removeAll()`, `removeAllRoles()`, `removeAllPermissions()`, `removeAllRules()` and `removeAllAssignments()` (qiangxue)
 - Chg: Added `$user` as the first parameter of `yii\rbac\Rule::execute()` (qiangxue)
diff --git a/framework/log/FileTarget.php b/framework/log/FileTarget.php
index efc3139..a9ab02d 100644
--- a/framework/log/FileTarget.php
+++ b/framework/log/FileTarget.php
@@ -52,16 +52,18 @@ class FileTarget extends Target
      */
     public $dirMode = 0775;
     /**
-     * @var boolean Whether to rotate primary log by copy and truncate
-     * which is more compatible with log tailers. Defaults to `false`.
+     * @var boolean Whether to rotate log files by copy and truncate in contrast to rotation by
+     * renaming files. Defaults to `true` to be more compatible with log tailers and is windows
+     * systems which do not play well with rename on open files. Rotation by renaming however is
+     * a bit faster.
      *
-     * This property can also be useful on windows systems where the
-     * [rename()](http://www.php.net/manual/en/function.rename.php) function has some problems.
-     * See the [comment by Martin Pelletier](http://www.php.net/manual/en/function.rename.php#102274) in
-     * the PHP documentation for details. By setting rotateByCopy to `true` you can work
+     * The problem with windows systems where the [rename()](http://www.php.net/manual/en/function.rename.php)
+     * function does not work with files that are opened by some process is described in a
+     * [comment by Martin Pelletier](http://www.php.net/manual/en/function.rename.php#102274) in
+     * the PHP documentation. By setting rotateByCopy to `true` you can work
      * around this problem.
      */
-    public $rotateByCopy = false;
+    public $rotateByCopy = true;
 
 
     /**
--
libgit2 0.27.1