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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
b1cf051a
Commit
b1cf051a
authored
May 26, 2014
by
Paweł 'Zibi' Zaremba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding rotateByCopy to yii\log\FileTarget #3562
parent
4b6b9d41
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
CHANGELOG.md
framework/CHANGELOG.md
+1
-0
FileTarget.php
framework/log/FileTarget.php
+13
-0
No files found.
framework/CHANGELOG.md
View file @
b1cf051a
...
@@ -57,6 +57,7 @@ Yii Framework 2 Change Log
...
@@ -57,6 +57,7 @@ Yii Framework 2 Change Log
-
Enh #3518:
`yii\helpers\Html::encode()`
now replaces invalid code sequences with "?" (DaSourcerer)
-
Enh #3518:
`yii\helpers\Html::encode()`
now replaces invalid code sequences with "?" (DaSourcerer)
-
Enh #3521: Added
`yii\filters\HttpCache::sessionCacheLimiter`
(qiangxue)
-
Enh #3521: Added
`yii\filters\HttpCache::sessionCacheLimiter`
(qiangxue)
-
Enh #3542: Removed requirement to specify
`extensions`
in application config (samdark)
-
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 #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: 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)
-
Enh: Supported adding a new response formatter without the need to reconfigure existing formatters (qiangxue)
...
...
framework/log/FileTarget.php
View file @
b1cf051a
...
@@ -51,6 +51,11 @@ class FileTarget extends Target
...
@@ -51,6 +51,11 @@ class FileTarget extends Target
* but read-only for other users.
* but read-only for other users.
*/
*/
public
$dirMode
=
0775
;
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.
* Initializes the route.
...
@@ -115,10 +120,18 @@ class FileTarget extends Target
...
@@ -115,10 +120,18 @@ class FileTarget extends Target
if
(
$i
===
$this
->
maxLogFiles
)
{
if
(
$i
===
$this
->
maxLogFiles
)
{
@
unlink
(
$rotateFile
);
@
unlink
(
$rotateFile
);
}
else
{
}
else
{
if
(
$this
->
rotateByCopy
)
{
@
copy
(
$rotateFile
,
$file
.
'.'
.
(
$i
+
1
));
if
(
$fp
=
@
fopen
(
$rotateFile
,
'a'
))
{
@
ftruncate
(
$fp
,
0
);
@
fclose
(
$fp
);
}
}
else
{
@
rename
(
$rotateFile
,
$file
.
'.'
.
(
$i
+
1
));
@
rename
(
$rotateFile
,
$file
.
'.'
.
(
$i
+
1
));
}
}
}
}
}
}
}
if
(
is_file
(
$file
))
{
if
(
is_file
(
$file
))
{
@
rename
(
$file
,
$file
.
'.1'
);
// suppress errors because it's possible multiple processes enter into this section
@
rename
(
$file
,
$file
.
'.1'
);
// suppress errors because it's possible multiple processes enter into this section
}
}
...
...
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