Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
a55d9ba8
Commit
a55d9ba8
authored
May 26, 2014
by
Paul Klimov
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3585 from pawzar/dev
Adding rotateByCopy to yii\log\FileTarget #3562
parents
4b6b9d41
b1cf051a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
CHANGELOG.md
framework/CHANGELOG.md
+1
-0
FileTarget.php
framework/log/FileTarget.php
+14
-1
No files found.
framework/CHANGELOG.md
View file @
a55d9ba8
...
...
@@ -57,6 +57,7 @@ Yii Framework 2 Change Log
-
Enh #3518:
`yii\helpers\Html::encode()`
now replaces invalid code sequences with "?" (DaSourcerer)
-
Enh #3521: Added
`yii\filters\HttpCache::sessionCacheLimiter`
(qiangxue)
-
Enh #3542: Removed requirement to specify
`extensions`
in application config (samdark)
-
Enh #3562: Adding rotateByCopy to yii
\l
og
\F
ileTarget (pawzar)
-
Enh #3574: Add integrity check support for SQLite (zeeke)
-
Enh: Added support for using sub-queries when building a DB query with
`IN`
condition (qiangxue)
-
Enh: Supported adding a new response formatter without the need to reconfigure existing formatters (qiangxue)
...
...
framework/log/FileTarget.php
View file @
a55d9ba8
...
...
@@ -51,6 +51,11 @@ class FileTarget extends Target
* but read-only for other users.
*/
public
$dirMode
=
0775
;
/**
* @var boolean Whether to rotate primary log by copy and truncate
* which is more compatible with log tailers. Defaults to false.
*/
public
$rotateByCopy
=
false
;
/**
* Initializes the route.
...
...
@@ -115,7 +120,15 @@ class FileTarget extends Target
if
(
$i
===
$this
->
maxLogFiles
)
{
@
unlink
(
$rotateFile
);
}
else
{
@
rename
(
$rotateFile
,
$file
.
'.'
.
(
$i
+
1
));
if
(
$this
->
rotateByCopy
)
{
@
copy
(
$rotateFile
,
$file
.
'.'
.
(
$i
+
1
));
if
(
$fp
=
@
fopen
(
$rotateFile
,
'a'
))
{
@
ftruncate
(
$fp
,
0
);
@
fclose
(
$fp
);
}
}
else
{
@
rename
(
$rotateFile
,
$file
.
'.'
.
(
$i
+
1
));
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment