[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-11-05 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14991839#comment-14991839
 ] 

ASF subversion and git services commented on TS-306:


Commit 53d4854434a2ab4cab26adfe6af2a1ef01bae224 in trafficserver's branch 
refs/heads/master from [~amc]
[ https://git-wip-us.apache.org/repos/asf?p=trafficserver.git;h=53d4854 ]

TS-306: Fix clang warning, ambiguous constructor use.


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-11-04 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14991248#comment-14991248
 ] 

ASF subversion and git services commented on TS-306:


Commit a4b33c664b3e5d7917ba5fd94d1683ee340efee0 in trafficserver's branch 
refs/heads/master from [~amc]
[ https://git-wip-us.apache.org/repos/asf?p=trafficserver.git;h=a4b33c6 ]

TS-306: Fix file open permission / elevation logic to accomodate CI build 
procedures.


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-11-04 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14991176#comment-14991176
 ] 

ASF subversion and git services commented on TS-306:


Commit 30ad083096eae278ff1236664edfb9bf421573a4 in trafficserver's branch 
refs/heads/master from [~amc]
[ https://git-wip-us.apache.org/repos/asf?p=trafficserver.git;h=30ad083 ]

TS-306: Fix regression and compile issues for certain architectures.


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-11-04 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14990991#comment-14990991
 ] 

ASF subversion and git services commented on TS-306:


Commit 6a5f624117c95c11cf47755a92e84fe250c19d3e in trafficserver's branch 
refs/heads/master from [~amc]
[ https://git-wip-us.apache.org/repos/asf?p=trafficserver.git;h=6a5f624 ]

TS-306: Fix file privilege elevation to work with log rotation.
This closes #322.


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-11-04 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14990992#comment-14990992
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user asfgit closed the pull request at:

https://github.com/apache/trafficserver/pull/322


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-11-04 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14990753#comment-14990753
 ] 

ASF GitHub Bot commented on TS-306:
---

GitHub user SolidWallOfCode opened a pull request:

https://github.com/apache/trafficserver/pull/322

TS-306: Fix file privilege elevation to work with log rotation.

This fixes several issues.

The biggest is DAC bypass privilege elevation. Because `traffic_server` is 
invoked in multiple ways (full deployment, standalone, via `gdb`, etc.) 
sometimes the process is privileged when the logfiles are bound and sometimes 
it is not. The existing elevation mechanism does not work if the process is 
already privileged because it incorrectly removes the privileges when it lowers 
privileges. I have changed this to save the current capability set and restore 
it on lowering so that it works in both cases.

I tweaked the buffering on the logfiles to avoid log messages apparently 
stopping in the middle.

I changed an argument naming to reserve leading underscores for class 
member variables.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/SolidWallOfCode/trafficserver ts-306

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/trafficserver/pull/322.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #322


commit a69b103bdd34c1287e83439f154cced5877f3fe1
Author: Alan M. Carroll 
Date:   2015-11-04T23:54:23Z

TS-306: Fix file privilege elevation to work with log rotation.




> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-11-04 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14990230#comment-14990230
 ] 

ASF subversion and git services commented on TS-306:


Commit 7bcc3b4f6acc003a4cc4478c2f7416590512afa3 in trafficserver's branch 
refs/heads/master from [~danobi]
[ https://git-wip-us.apache.org/repos/asf?p=trafficserver.git;h=7bcc3b4 ]

TS-306: Enable log rotation for diags.log & traffic.out

Fix coverity and clang-analyzer issues

Fixed coverity issues:
   1338077 1338076 1338075 1338074 1338073 1338072 1338071


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-11-03 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14988713#comment-14988713
 ] 

ASF subversion and git services commented on TS-306:


Commit 32dafee0200aee761ec57c9ade613a38c952a03a in trafficserver's branch 
refs/heads/master from [~bcall]
[ https://git-wip-us.apache.org/repos/asf?p=trafficserver.git;h=32dafee ]

TS-306: Enable log rotation for diags.log & traffic.out
Fixed broken builds because of unused var


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-11-02 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14985429#comment-14985429
 ] 

ASF subversion and git services commented on TS-306:


Commit f648b17ea00c2620e90105e025888d608e0d6b7c in trafficserver's branch 
refs/heads/master from [~amc]
[ https://git-wip-us.apache.org/repos/asf?p=trafficserver.git;h=f648b17 ]

TS-306: Formatting fixes.


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-11-02 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14985408#comment-14985408
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user asfgit closed the pull request at:

https://github.com/apache/trafficserver/pull/274


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-11-02 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14985407#comment-14985407
 ] 

ASF subversion and git services commented on TS-306:


Commit 5cf0ae901502b7ed22bde56b1d8539aa7cc1c614 in trafficserver's branch 
refs/heads/master from [~danobi]
[ https://git-wip-us.apache.org/repos/asf?p=trafficserver.git;h=5cf0ae9 ]

TS-306: Enable log rotation for diags.log & traffic.out
This closes #274.


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14693966#comment-14693966
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user danobi commented on the pull request:

https://github.com/apache/trafficserver/pull/274#issuecomment-130400177
  
Thanks for all the input, I appreciate it.


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14693914#comment-14693914
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user SolidWallOfCode commented on the pull request:

https://github.com/apache/trafficserver/pull/274#issuecomment-130386828
  
That's all my comments for now, looking much better.


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14693900#comment-14693900
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user danobi commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36889035
  
--- Diff: proxy/Makefile.am ---
@@ -46,7 +46,7 @@ AM_CPPFLAGS = \
   -I$(top_srcdir)/mgmt \
   -I$(top_srcdir)/mgmt/utils \
   -I$(top_srcdir)/proxy/api/ts \
-  -I$(top_srcdir)/lib \
+  -I$(top_srcdir)/lib
--- End diff --

Whoops, must not have noticed the `@OPENSSL_INCLUDES@` underneath.


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14693894#comment-14693894
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user SolidWallOfCode commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36888489
  
--- Diff: proxy/Makefile.am ---
@@ -46,7 +46,7 @@ AM_CPPFLAGS = \
   -I$(top_srcdir)/mgmt \
   -I$(top_srcdir)/mgmt/utils \
   -I$(top_srcdir)/proxy/api/ts \
-  -I$(top_srcdir)/lib \
+  -I$(top_srcdir)/lib
--- End diff --

Why was this changed? It looks like it would break @OPENSSL_INCLUDES@. If 
that's not needed it should be removed entirely. My test indicates it is not 
needed.


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14693877#comment-14693877
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user SolidWallOfCode commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36887236
  
--- Diff: lib/ts/Diags.h ---
@@ -36,12 +36,14 @@
 #define __DIAGS_H___
 
 #include 
-#include "ts/ink_error.h"
-#include "ts/ink_mutex.h"
-#include "ts/Regex.h"
-#include "ts/ink_apidefs.h"
+#include "ink_error.h"
--- End diff --

Don't make this change. It compiles as it was originally.


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14693848#comment-14693848
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user danobi commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36885521
  
--- Diff: lib/ts/BaseLogFile.cc ---
@@ -0,0 +1,578 @@
+/** @file
+
+  Base class for log files implementation
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#include "BaseLogFile.h"
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * This is the most common way BaseLogFiles are created.
+ */
+BaseLogFile::BaseLogFile(const char *name) : m_signature(0), 
m_has_signature(false)
+{
+  init(name);
+  log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n", 
(char *)m_name, this);
+}
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * Similar to above constructor, but is overloaded with the object 
signature
+ */
+BaseLogFile::BaseLogFile(const char *name, uint64_t sig) : 
m_signature(sig), m_has_signature(true)
+{
+  init(name);
+  log_log_trace("exiting BaseLogFile signature constructor, m_name=%s, 
m_signature=%ld, this=%p\n", (char *)m_name, m_signature,
+this);
+}
+
+/*
+ * This copy constructor creates a BaseLogFile based on a given copy.
+ */
+BaseLogFile::BaseLogFile(const BaseLogFile ©)
+  : m_fp(NULL), m_start_time(copy.m_start_time), m_end_time(0L), 
m_bytes_written(0), m_signature(copy.m_signature),
+m_has_signature(copy.m_has_signature), 
m_name(ats_strdup(copy.m_name)), m_hostname(ats_strdup(copy.m_hostname)),
+m_is_regfile(false), m_is_init(copy.m_is_init), m_meta_info(NULL)
+{
+  log_log_trace("exiting BaseLogFile copy constructor, m_name=%s, 
this=%p\n", (char *)m_name, this);
+}
+
+/*
+ * Destructor.
+ */
+BaseLogFile::~BaseLogFile()
+{
+  log_log_trace("entering BaseLogFile destructor, m_name=%s, this=%p\n", 
(char *)m_name, this);
+
+  if (m_is_regfile)
+close_file();
+  else
+log_log_trace("not a regular file, not closing, m_name=%s, this=%p\n", 
(char *)m_name, this);
+
+  log_log_trace("exiting BaseLogFile destructor, this=%p\n", this);
+}
+
+/*
+ * Initializes the defaults of some of the common member values of this 
class
+ */
+void
+BaseLogFile::init(const char *name)
+{
+  m_fp = NULL;
+  m_start_time = time(0);
+  m_end_time = 0L;
+  m_bytes_written = 0;
+  m_name = ats_strdup(name);
+  m_hostname = NULL;
+  m_is_regfile = false;
+  m_is_init = false;
+  m_meta_info = NULL;
+}
+
+/*
+ * This function is called by a client of BaseLogFile to roll the 
underlying
+ * file  The tricky part to this routine is in coming up with the new file 
name,
+ * which contains the bounding timestamp interval for the entries
+ * within the file.
+
+ * Under normal operating conditions, this BaseLogFile object was in 
existence
+ * for all writes to the file.  In this case, the LogFile members 
m_start_time
+ * and m_end_time will have the starting and ending times for the actual
+ * entries written to the file.
+
+ * On restart situations, it is possible to re-open an existing 
BaseLogFile,
+ * which means that the m_start_time variable will be later than the actual
+ * entries recorded in the file.  In this case, we'll use the creation time
+ * of the file, which should be recorded in the meta-information located on
+ * disk.
+
+ * If we can't use the meta-file, either because it's not there or because
+ * it's not valid, then we'll use timestamp 0 (Jan 1, 1970) as the starting
+ * bound.
+
+ * Return 1 if file rolled, 0 otherwise
+ */
+int
+BaseLogFile::roll(long interval_start, long interval_end)
+

[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14693812#comment-14693812
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user SolidWallOfCode commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36883442
  
--- Diff: lib/ts/BaseLogFile.cc ---
@@ -0,0 +1,578 @@
+/** @file
+
+  Base class for log files implementation
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#include "BaseLogFile.h"
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * This is the most common way BaseLogFiles are created.
+ */
+BaseLogFile::BaseLogFile(const char *name) : m_signature(0), 
m_has_signature(false)
+{
+  init(name);
+  log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n", 
(char *)m_name, this);
+}
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * Similar to above constructor, but is overloaded with the object 
signature
+ */
+BaseLogFile::BaseLogFile(const char *name, uint64_t sig) : 
m_signature(sig), m_has_signature(true)
+{
+  init(name);
+  log_log_trace("exiting BaseLogFile signature constructor, m_name=%s, 
m_signature=%ld, this=%p\n", (char *)m_name, m_signature,
+this);
+}
+
+/*
+ * This copy constructor creates a BaseLogFile based on a given copy.
+ */
+BaseLogFile::BaseLogFile(const BaseLogFile ©)
+  : m_fp(NULL), m_start_time(copy.m_start_time), m_end_time(0L), 
m_bytes_written(0), m_signature(copy.m_signature),
+m_has_signature(copy.m_has_signature), 
m_name(ats_strdup(copy.m_name)), m_hostname(ats_strdup(copy.m_hostname)),
+m_is_regfile(false), m_is_init(copy.m_is_init), m_meta_info(NULL)
+{
+  log_log_trace("exiting BaseLogFile copy constructor, m_name=%s, 
this=%p\n", (char *)m_name, this);
+}
+
+/*
+ * Destructor.
+ */
+BaseLogFile::~BaseLogFile()
+{
+  log_log_trace("entering BaseLogFile destructor, m_name=%s, this=%p\n", 
(char *)m_name, this);
+
+  if (m_is_regfile)
+close_file();
+  else
+log_log_trace("not a regular file, not closing, m_name=%s, this=%p\n", 
(char *)m_name, this);
+
+  log_log_trace("exiting BaseLogFile destructor, this=%p\n", this);
+}
+
+/*
+ * Initializes the defaults of some of the common member values of this 
class
+ */
+void
+BaseLogFile::init(const char *name)
+{
+  m_fp = NULL;
+  m_start_time = time(0);
+  m_end_time = 0L;
+  m_bytes_written = 0;
+  m_name = ats_strdup(name);
+  m_hostname = NULL;
+  m_is_regfile = false;
+  m_is_init = false;
+  m_meta_info = NULL;
+}
+
+/*
+ * This function is called by a client of BaseLogFile to roll the 
underlying
+ * file  The tricky part to this routine is in coming up with the new file 
name,
+ * which contains the bounding timestamp interval for the entries
+ * within the file.
+
+ * Under normal operating conditions, this BaseLogFile object was in 
existence
+ * for all writes to the file.  In this case, the LogFile members 
m_start_time
+ * and m_end_time will have the starting and ending times for the actual
+ * entries written to the file.
+
+ * On restart situations, it is possible to re-open an existing 
BaseLogFile,
+ * which means that the m_start_time variable will be later than the actual
+ * entries recorded in the file.  In this case, we'll use the creation time
+ * of the file, which should be recorded in the meta-information located on
+ * disk.
+
+ * If we can't use the meta-file, either because it's not there or because
+ * it's not valid, then we'll use timestamp 0 (Jan 1, 1970) as the starting
+ * bound.
+
+ * Return 1 if file rolled, 0 otherwise
+ */
+int
+BaseLogFile::roll(long interval_start, long interval_e

[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14693805#comment-14693805
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user SolidWallOfCode commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36883269
  
--- Diff: lib/ts/BaseLogFile.cc ---
@@ -0,0 +1,578 @@
+/** @file
+
+  Base class for log files implementation
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#include "BaseLogFile.h"
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * This is the most common way BaseLogFiles are created.
+ */
+BaseLogFile::BaseLogFile(const char *name) : m_signature(0), 
m_has_signature(false)
+{
+  init(name);
+  log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n", 
(char *)m_name, this);
+}
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * Similar to above constructor, but is overloaded with the object 
signature
+ */
+BaseLogFile::BaseLogFile(const char *name, uint64_t sig) : 
m_signature(sig), m_has_signature(true)
+{
+  init(name);
+  log_log_trace("exiting BaseLogFile signature constructor, m_name=%s, 
m_signature=%ld, this=%p\n", (char *)m_name, m_signature,
+this);
+}
+
+/*
+ * This copy constructor creates a BaseLogFile based on a given copy.
+ */
+BaseLogFile::BaseLogFile(const BaseLogFile ©)
+  : m_fp(NULL), m_start_time(copy.m_start_time), m_end_time(0L), 
m_bytes_written(0), m_signature(copy.m_signature),
+m_has_signature(copy.m_has_signature), 
m_name(ats_strdup(copy.m_name)), m_hostname(ats_strdup(copy.m_hostname)),
+m_is_regfile(false), m_is_init(copy.m_is_init), m_meta_info(NULL)
+{
+  log_log_trace("exiting BaseLogFile copy constructor, m_name=%s, 
this=%p\n", (char *)m_name, this);
+}
+
+/*
+ * Destructor.
+ */
+BaseLogFile::~BaseLogFile()
+{
+  log_log_trace("entering BaseLogFile destructor, m_name=%s, this=%p\n", 
(char *)m_name, this);
+
+  if (m_is_regfile)
+close_file();
+  else
+log_log_trace("not a regular file, not closing, m_name=%s, this=%p\n", 
(char *)m_name, this);
+
+  log_log_trace("exiting BaseLogFile destructor, this=%p\n", this);
+}
+
+/*
+ * Initializes the defaults of some of the common member values of this 
class
+ */
+void
+BaseLogFile::init(const char *name)
+{
+  m_fp = NULL;
+  m_start_time = time(0);
+  m_end_time = 0L;
+  m_bytes_written = 0;
+  m_name = ats_strdup(name);
+  m_hostname = NULL;
+  m_is_regfile = false;
+  m_is_init = false;
+  m_meta_info = NULL;
+}
+
+/*
+ * This function is called by a client of BaseLogFile to roll the 
underlying
+ * file  The tricky part to this routine is in coming up with the new file 
name,
+ * which contains the bounding timestamp interval for the entries
+ * within the file.
+
+ * Under normal operating conditions, this BaseLogFile object was in 
existence
+ * for all writes to the file.  In this case, the LogFile members 
m_start_time
+ * and m_end_time will have the starting and ending times for the actual
+ * entries written to the file.
+
+ * On restart situations, it is possible to re-open an existing 
BaseLogFile,
+ * which means that the m_start_time variable will be later than the actual
+ * entries recorded in the file.  In this case, we'll use the creation time
+ * of the file, which should be recorded in the meta-information located on
+ * disk.
+
+ * If we can't use the meta-file, either because it's not there or because
+ * it's not valid, then we'll use timestamp 0 (Jan 1, 1970) as the starting
+ * bound.
+
+ * Return 1 if file rolled, 0 otherwise
+ */
+int
+BaseLogFile::roll(long interval_start, long interval_e

[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14693774#comment-14693774
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user SolidWallOfCode commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36881681
  
--- Diff: iocore/eventsystem/test_Buffer.cc ---
@@ -91,23 +91,13 @@ reconfigure_diags()
 static void
 init_diags(const char *bdt, const char *bat)
 {
-  FILE *diags_log_fp;
   char diags_logpath[500];
   ink_strlcpy(diags_logpath, DIAGS_LOG_FILE, sizeof(diags_logpath));
 
-  diags_log_fp = fopen(diags_logpath, "w");
-  if (diags_log_fp) {
-int status;
-status = setvbuf(diags_log_fp, NULL, _IOLBF, 512);
-if (status != 0) {
-  fclose(diags_log_fp);
-  diags_log_fp = NULL;
-}
-  }
-
-  diags = new Diags(bdt, bat, diags_log_fp);
+  BaseLogFile *blf = new BaseLogFile(diags_logpath);
+  diags = new Diags(bdt, bat, blf);
 
-  if (diags_log_fp == NULL) {
+  if (blf && blf->m_fp == NULL) {
--- End diff --

`if (blf == NULL || blf->m_fp == NULL)` - you certainly don't want to 
continue on if `blf` is `NULL`.


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14693767#comment-14693767
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user SolidWallOfCode commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36881282
  
--- Diff: doc/reference/configuration/records.config.en.rst ---
@@ -214,6 +214,28 @@ A value of ``0`` means no signal will be sent.
The name and location of the file that contains warnings, status 
messages, and error messages produced by the Traffic Server
processes. If no path is specified, then Traffic Server creates the 
file in its logging directory.
 
+.. ts:cv:: CONFIG proxy.config.output.logfile.rolling_enabled INT 0
+   :reloadable:
+
+   Specifies how the output log is rolled. You can specify the following 
values:
+
+   -  ``0`` = disables output log rolling
+   -  ``1`` = enables output log rolling at specific intervals (specified 
with the
+   `proxy.config.output.logfile.rolling_interval_sec`_ variable). The 
"clock" starts ticking on Traffic Server boot
--- End diff --

ts:cv:`proxy.config.output.logfile.rolling_interval_sec`


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14692397#comment-14692397
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user danobi commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36807553
  
--- Diff: iocore/net/test_certlookup.cc ---
@@ -206,7 +206,8 @@ SSLReleaseContext(SSL_CTX *ctx)
 int
 main(int argc, const char **argv)
 {
-  diags = new Diags(NULL, NULL, stdout);
+  BaseLogFile *blf = new BaseLogFile("stdout");
+  diags = new Diags(NULL, NULL, blf);
--- End diff --

If the third parameter is changed into `const char *`, there will exist 
constructor ambiguities when, for example, `NULL` is the third parameter. I'm 
probably missing something here, but I think any changes (that I can currently 
think of) made to the API to disambiguate the parameters would decrease the 
overall understandability of the API.  


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14687401#comment-14687401
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user SolidWallOfCode commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36800085
  
--- Diff: lib/ts/BaseLogFile.cc ---
@@ -0,0 +1,571 @@
+/** @file
+
+  Base class for log files implementation
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#include "BaseLogFile.h"
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * This is the most common way BaseLogFiles are created.
+ */
+BaseLogFile::BaseLogFile(const char *name)
+  : m_name(ats_strdup(name)), m_hostname(NULL), m_is_regfile(false), 
m_has_signature(false), m_signature(0), m_is_init(false)
+{
+  m_fp = NULL;
+  m_start_time = time(0);
+  m_end_time = 0L;
+  m_bytes_written = 0;
+  m_meta_info = NULL;
+
+  log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n", 
m_name, this);
+}
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * Similar to above constructor, but is overloaded with the object 
signature
+ */
+BaseLogFile::BaseLogFile(const char *name, uint64_t sig)
+  : m_name(ats_strdup(name)), m_hostname(NULL), m_is_regfile(false), 
m_has_signature(true), m_signature(sig), m_is_init(false)
+{
+  m_fp = NULL;
+  m_start_time = time(0);
+  m_end_time = 0L;
+  m_bytes_written = 0;
+  m_meta_info = NULL;
+
+  log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n", 
m_name, this);
+}
+
+/*
+ * This copy constructor creates a BaseLogFile based on a given copy.
+ */
+BaseLogFile::BaseLogFile(const BaseLogFile ©)
+  : m_fp(NULL), m_start_time(copy.m_start_time), m_end_time(0L), 
m_bytes_written(0), m_name(ats_strdup(copy.m_name)),
+m_hostname(ats_strdup(m_hostname)), m_is_regfile(false), 
m_has_signature(copy.m_has_signature), m_signature(copy.m_signature),
+m_is_init(copy.m_is_init), m_meta_info(NULL)
+{
+  log_log_trace("exiting BaseLogFile copy constructor, m_name=%s, 
this=%p\n", m_name, this);
+}
+
+/*
+ * Destructor.
+ */
+BaseLogFile::~BaseLogFile()
+{
+  log_log_trace("entering BaseLogFile destructor, m_name=%s, this=%p\n", 
m_name, this);
+
+  if (m_is_regfile)
+close_file();
+  else
+log_log_trace("not a regular file, not closing, m_name=%s, this=%p\n", 
m_name, this);
+  if (m_name)
+ats_free(m_name);
--- End diff --

If you declare one as a member, it will have the same life time as the 
instance of which it is a member.


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a 

[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682435#comment-14682435
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user danobi commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36794702
  
--- Diff: lib/ts/BaseLogFile.cc ---
@@ -0,0 +1,571 @@
+/** @file
+
+  Base class for log files implementation
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#include "BaseLogFile.h"
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * This is the most common way BaseLogFiles are created.
+ */
+BaseLogFile::BaseLogFile(const char *name)
+  : m_name(ats_strdup(name)), m_hostname(NULL), m_is_regfile(false), 
m_has_signature(false), m_signature(0), m_is_init(false)
+{
+  m_fp = NULL;
+  m_start_time = time(0);
+  m_end_time = 0L;
+  m_bytes_written = 0;
+  m_meta_info = NULL;
+
+  log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n", 
m_name, this);
+}
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * Similar to above constructor, but is overloaded with the object 
signature
+ */
+BaseLogFile::BaseLogFile(const char *name, uint64_t sig)
+  : m_name(ats_strdup(name)), m_hostname(NULL), m_is_regfile(false), 
m_has_signature(true), m_signature(sig), m_is_init(false)
+{
+  m_fp = NULL;
+  m_start_time = time(0);
+  m_end_time = 0L;
+  m_bytes_written = 0;
+  m_meta_info = NULL;
+
+  log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n", 
m_name, this);
+}
+
+/*
+ * This copy constructor creates a BaseLogFile based on a given copy.
+ */
+BaseLogFile::BaseLogFile(const BaseLogFile ©)
+  : m_fp(NULL), m_start_time(copy.m_start_time), m_end_time(0L), 
m_bytes_written(0), m_name(ats_strdup(copy.m_name)),
+m_hostname(ats_strdup(m_hostname)), m_is_regfile(false), 
m_has_signature(copy.m_has_signature), m_signature(copy.m_signature),
+m_is_init(copy.m_is_init), m_meta_info(NULL)
+{
+  log_log_trace("exiting BaseLogFile copy constructor, m_name=%s, 
this=%p\n", m_name, this);
+}
+
+/*
+ * Destructor.
+ */
+BaseLogFile::~BaseLogFile()
+{
+  log_log_trace("entering BaseLogFile destructor, m_name=%s, this=%p\n", 
m_name, this);
+
+  if (m_is_regfile)
+close_file();
+  else
+log_log_trace("not a regular file, not closing, m_name=%s, this=%p\n", 
m_name, this);
+  if (m_name)
+ats_free(m_name);
--- End diff --

I took a look and (I might be wrong) it looks like `ats_scoped_str` 's only 
live as long as the most immediate scope. I'm not sure how it could be used for 
the life of an object.


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
>

[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682275#comment-14682275
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user SolidWallOfCode commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36782875
  
--- Diff: lib/ts/BaseLogFile.cc ---
@@ -0,0 +1,571 @@
+/** @file
+
+  Base class for log files implementation
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#include "BaseLogFile.h"
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * This is the most common way BaseLogFiles are created.
+ */
+BaseLogFile::BaseLogFile(const char *name)
+  : m_name(ats_strdup(name)), m_hostname(NULL), m_is_regfile(false), 
m_has_signature(false), m_signature(0), m_is_init(false)
+{
+  m_fp = NULL;
+  m_start_time = time(0);
+  m_end_time = 0L;
+  m_bytes_written = 0;
+  m_meta_info = NULL;
+
+  log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n", 
m_name, this);
+}
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * Similar to above constructor, but is overloaded with the object 
signature
+ */
+BaseLogFile::BaseLogFile(const char *name, uint64_t sig)
--- End diff --

If there's really no good default value to signal not passed, you may have 
to just have these two. A couple of mitigations -

If you're going to do member initialization via assignment anyway, you 
could create an `init` method that is called from the constructors to do that 
thereby not duplicating the code.

More obscurely I have created a super class with the common constructed 
members and used private or protected inheritance because no client cares about 
that, but you can then unify the common member initialization there. Some 
people frown on that, though, because it splits the member declarations from 
the "real" class. Note that you don't need to qualify any of the member names 
when used later.


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682255#comment-14682255
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user SolidWallOfCode commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36781478
  
--- Diff: proxy/logging/LogFile.cc ---
@@ -754,115 +585,33 @@ LogFile::display(FILE *fd)
   fprintf(fd, "Logfile: %s, %s\n", get_name(), (is_open()) ? "file is 
open" : "file is not open");
 }
 

-/***
- LogFileList IS NOT USED

-/
-
-

-/
-
-  MetaInfo methods
-

-*/
-
-void
-MetaInfo::_build_name(const char *filename)
+bool
+LogFile::is_open()
 {
-  int i = -1, l = 0;
-  char c;
-  while (c = filename[l], c != 0) {
-if (c == '/') {
-  i = l;
-}
-++l;
-  }
-
-  // 7 = 1 (dot at beginning) + 5 (".meta") + 1 (null terminating)
-  //
-  _filename = (char *)ats_malloc(l + 7);
-
-  if (i < 0) {
-ink_string_concatenate_strings(_filename, ".", filename, ".meta", 
NULL);
-  } else {
-memcpy(_filename, filename, i + 1);
-ink_string_concatenate_strings(&_filename[i + 1], ".", &filename[i + 
1], ".meta", NULL);
-  }
+  if (m_file_format == LOG_FILE_PIPE)
+return (m_fd >= 0);
--- End diff --

'return m_fd >= 0;'


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682253#comment-14682253
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user danobi commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36781403
  
--- Diff: lib/ts/BaseLogFile.cc ---
@@ -0,0 +1,571 @@
+/** @file
+
+  Base class for log files implementation
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#include "BaseLogFile.h"
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * This is the most common way BaseLogFiles are created.
+ */
+BaseLogFile::BaseLogFile(const char *name)
+  : m_name(ats_strdup(name)), m_hostname(NULL), m_is_regfile(false), 
m_has_signature(false), m_signature(0), m_is_init(false)
+{
+  m_fp = NULL;
+  m_start_time = time(0);
+  m_end_time = 0L;
+  m_bytes_written = 0;
+  m_meta_info = NULL;
+
+  log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n", 
m_name, this);
+}
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * Similar to above constructor, but is overloaded with the object 
signature
+ */
+BaseLogFile::BaseLogFile(const char *name, uint64_t sig)
+  : m_name(ats_strdup(name)), m_hostname(NULL), m_is_regfile(false), 
m_has_signature(true), m_signature(sig), m_is_init(false)
+{
+  m_fp = NULL;
+  m_start_time = time(0);
+  m_end_time = 0L;
+  m_bytes_written = 0;
+  m_meta_info = NULL;
+
+  log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n", 
m_name, this);
+}
+
+/*
+ * This copy constructor creates a BaseLogFile based on a given copy.
+ */
+BaseLogFile::BaseLogFile(const BaseLogFile ©)
+  : m_fp(NULL), m_start_time(copy.m_start_time), m_end_time(0L), 
m_bytes_written(0), m_name(ats_strdup(copy.m_name)),
+m_hostname(ats_strdup(m_hostname)), m_is_regfile(false), 
m_has_signature(copy.m_has_signature), m_signature(copy.m_signature),
+m_is_init(copy.m_is_init), m_meta_info(NULL)
+{
+  log_log_trace("exiting BaseLogFile copy constructor, m_name=%s, 
this=%p\n", m_name, this);
+}
+
+/*
+ * Destructor.
+ */
+BaseLogFile::~BaseLogFile()
+{
+  log_log_trace("entering BaseLogFile destructor, m_name=%s, this=%p\n", 
m_name, this);
+
+  if (m_is_regfile)
+close_file();
+  else
+log_log_trace("not a regular file, not closing, m_name=%s, this=%p\n", 
m_name, this);
+  if (m_name)
+ats_free(m_name);
+  if (m_hostname)
+ats_free(m_hostname);
+
+  log_log_trace("exiting BaseLogFile destructor, this=%p\n", this);
+}
+
+/*
+ * This function is called by a client of BaseLogFile to roll the 
underlying
+ * file  The tricky part to this routine is in coming up with the new file 
name,
+ * which contains the bounding timestamp interval for the entries
+ * within the file.
+
+ * Under normal operating conditions, this BaseLogFile object was in 
existence
+ * for all writes to the file.  In this case, the LogFile members 
m_start_time
+ * and m_end_time will have the starting and ending times for the actual
+ * entries written to the file.
+
+ * On restart situations, it is possible to re-open an existing 
BaseLogFile,
+ * which means that the m_start_time variable will be later than the actual
+ * entries recorded in the file.  In this case, we'll use the creation time
+ * of the file, which should be recorded in the meta-information located on
+ * disk.
+
+ * If we can't use the meta-file, either because it's not there or because
+ * it's not valid, then we'll use timestamp 0 (Jan 1, 1970) as the starting
+ * bound.
+
+ * Return 1 if file rolled, 0 otherwise
+ */
+int
+BaseLogFile::roll(long interval_start, long interval_end)
--- End di

[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682241#comment-14682241
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user SolidWallOfCode commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36780749
  
--- Diff: cmd/traffic_crashlog/Makefile.am ---
@@ -20,6 +20,7 @@ bin_PROGRAMS = traffic_crashlog
 AM_CPPFLAGS = \
   $(iocore_include_dirs) \
   -I$(top_srcdir)/lib \
+  -I$(top_srcdir)/lib/ts \
--- End diff --

Well, Leif will go ballistic if this creeps back in, it was a very painful 
experience to take it out.


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682196#comment-14682196
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user danobi commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36778052
  
--- Diff: lib/ts/BaseLogFile.cc ---
@@ -0,0 +1,571 @@
+/** @file
+
+  Base class for log files implementation
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#include "BaseLogFile.h"
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * This is the most common way BaseLogFiles are created.
+ */
+BaseLogFile::BaseLogFile(const char *name)
+  : m_name(ats_strdup(name)), m_hostname(NULL), m_is_regfile(false), 
m_has_signature(false), m_signature(0), m_is_init(false)
+{
+  m_fp = NULL;
+  m_start_time = time(0);
+  m_end_time = 0L;
+  m_bytes_written = 0;
+  m_meta_info = NULL;
+
+  log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n", 
m_name, this);
+}
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * Similar to above constructor, but is overloaded with the object 
signature
+ */
+BaseLogFile::BaseLogFile(const char *name, uint64_t sig)
--- End diff --

I would actually like some advice on the constructor arguments part. I 
originally wanted to make the signature a default parameter, but I couldn't 
think of a good default value. `BaseLogFile` must be able to support having an 
optional signature. Unless my understanding of the hash implementation is 
wrong, theoretically any value that `long` can represent can be a valid hash. 
That's why I added the `m_has_signature` flag. 


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682186#comment-14682186
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user SolidWallOfCode commented on the pull request:

https://github.com/apache/trafficserver/pull/274#issuecomment-129997435
  
jpeach;

I know this has been discussed quite a bit and I've always heard about 
doing the rotation for `traffic.out` and `diags.log` (as in the original bug 
description) and never heard mention of being more supportive of an external 
rotation tool. I think having two different mechanisms, though, (one for these 
files and another for the other log files) is the worst choice. We should 
require an external tool or not for everything.


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682182#comment-14682182
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user SolidWallOfCode commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36777148
  
--- Diff: proxy/logging/Makefile.am ---
@@ -27,7 +28,7 @@ AM_CPPFLAGS = \
   -I$(top_srcdir)/proxy/hdrs \
   -I$(top_srcdir)/proxy/shared \
   -I$(top_srcdir)/mgmt \
-  -I$(top_srcdir)/mgmt/utils
+  -I$(top_srcdir)/mgmt/utils 
--- End diff --

No trailing spaces.


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682181#comment-14682181
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user SolidWallOfCode commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36777072
  
--- Diff: proxy/logging/LogFile.h ---
@@ -177,7 +92,12 @@ class LogFile : public LogBufferSink, public RefCountObj
   off_t
   get_size_bytes() const
   {
-return m_file_format != LOG_FILE_PIPE ? m_bytes_written : 0;
+if (m_file_format == LOG_FILE_PIPE)
+  return 0;
+else if (m_log)
+  return m_log->get_size_bytes();
+else
+  return 0;
--- End diff --

`return m_file_format == LOG_PIPE_FILE ? 0 : m_log ? 
m_log->get_size_bytes() : 0;`

Maybe. That's just my personal style.


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682177#comment-14682177
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user danobi commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36776891
  
--- Diff: lib/ts/BaseLogFile.cc ---
@@ -0,0 +1,571 @@
+/** @file
+
+  Base class for log files implementation
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#include "BaseLogFile.h"
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * This is the most common way BaseLogFiles are created.
+ */
+BaseLogFile::BaseLogFile(const char *name)
+  : m_name(ats_strdup(name)), m_hostname(NULL), m_is_regfile(false), 
m_has_signature(false), m_signature(0), m_is_init(false)
+{
+  m_fp = NULL;
+  m_start_time = time(0);
+  m_end_time = 0L;
+  m_bytes_written = 0;
+  m_meta_info = NULL;
+
+  log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n", 
m_name, this);
+}
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * Similar to above constructor, but is overloaded with the object 
signature
+ */
+BaseLogFile::BaseLogFile(const char *name, uint64_t sig)
+  : m_name(ats_strdup(name)), m_hostname(NULL), m_is_regfile(false), 
m_has_signature(true), m_signature(sig), m_is_init(false)
+{
+  m_fp = NULL;
+  m_start_time = time(0);
+  m_end_time = 0L;
+  m_bytes_written = 0;
+  m_meta_info = NULL;
+
+  log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n", 
m_name, this);
+}
+
+/*
+ * This copy constructor creates a BaseLogFile based on a given copy.
+ */
+BaseLogFile::BaseLogFile(const BaseLogFile ©)
+  : m_fp(NULL), m_start_time(copy.m_start_time), m_end_time(0L), 
m_bytes_written(0), m_name(ats_strdup(copy.m_name)),
+m_hostname(ats_strdup(m_hostname)), m_is_regfile(false), 
m_has_signature(copy.m_has_signature), m_signature(copy.m_signature),
--- End diff --

Typo, whoops. Was supposed to be `m_hostname(ats_strdup(copy.m_hostname))`


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682176#comment-14682176
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user SolidWallOfCode commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36776865
  
--- Diff: proxy/logging/LogFile.h ---
@@ -168,8 +85,6 @@ class LogFile : public LogBufferSink, public RefCountObj
 
   static int write_ascii_logbuffer(LogBufferHeader *buffer_header, int fd, 
const char *path, const char *alt_format = NULL);
   int write_ascii_logbuffer3(LogBufferHeader *buffer_header, const char 
*alt_format = NULL);
-  static bool rolled_logfile(char *file);
-  static bool exists(const char *pathname);
--- End diff --

Is it worth taking these out? For client convenience it you could leave 
them in and have them just forward to the `BaseLogFile` methods. Otherwise 
you're forcing clients to be aware of the implementation details of `LogFile` 
(e.g. that it uses `BaseLogFile`).


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682170#comment-14682170
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user SolidWallOfCode commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36776263
  
--- Diff: lib/ts/BaseLogFile.cc ---
@@ -0,0 +1,571 @@
+/** @file
+
+  Base class for log files implementation
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#include "BaseLogFile.h"
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * This is the most common way BaseLogFiles are created.
+ */
+BaseLogFile::BaseLogFile(const char *name)
+  : m_name(ats_strdup(name)), m_hostname(NULL), m_is_regfile(false), 
m_has_signature(false), m_signature(0), m_is_init(false)
+{
+  m_fp = NULL;
+  m_start_time = time(0);
+  m_end_time = 0L;
+  m_bytes_written = 0;
+  m_meta_info = NULL;
+
+  log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n", 
m_name, this);
+}
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * Similar to above constructor, but is overloaded with the object 
signature
+ */
+BaseLogFile::BaseLogFile(const char *name, uint64_t sig)
+  : m_name(ats_strdup(name)), m_hostname(NULL), m_is_regfile(false), 
m_has_signature(true), m_signature(sig), m_is_init(false)
+{
+  m_fp = NULL;
+  m_start_time = time(0);
+  m_end_time = 0L;
+  m_bytes_written = 0;
+  m_meta_info = NULL;
+
+  log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n", 
m_name, this);
+}
+
+/*
+ * This copy constructor creates a BaseLogFile based on a given copy.
+ */
+BaseLogFile::BaseLogFile(const BaseLogFile ©)
+  : m_fp(NULL), m_start_time(copy.m_start_time), m_end_time(0L), 
m_bytes_written(0), m_name(ats_strdup(copy.m_name)),
+m_hostname(ats_strdup(m_hostname)), m_is_regfile(false), 
m_has_signature(copy.m_has_signature), m_signature(copy.m_signature),
+m_is_init(copy.m_is_init), m_meta_info(NULL)
+{
+  log_log_trace("exiting BaseLogFile copy constructor, m_name=%s, 
this=%p\n", m_name, this);
+}
+
+/*
+ * Destructor.
+ */
+BaseLogFile::~BaseLogFile()
+{
+  log_log_trace("entering BaseLogFile destructor, m_name=%s, this=%p\n", 
m_name, this);
+
+  if (m_is_regfile)
+close_file();
+  else
+log_log_trace("not a regular file, not closing, m_name=%s, this=%p\n", 
m_name, this);
+  if (m_name)
+ats_free(m_name);
+  if (m_hostname)
+ats_free(m_hostname);
+
+  log_log_trace("exiting BaseLogFile destructor, this=%p\n", this);
+}
+
+/*
+ * This function is called by a client of BaseLogFile to roll the 
underlying
+ * file  The tricky part to this routine is in coming up with the new file 
name,
+ * which contains the bounding timestamp interval for the entries
+ * within the file.
+
+ * Under normal operating conditions, this BaseLogFile object was in 
existence
+ * for all writes to the file.  In this case, the LogFile members 
m_start_time
+ * and m_end_time will have the starting and ending times for the actual
+ * entries written to the file.
+
+ * On restart situations, it is possible to re-open an existing 
BaseLogFile,
+ * which means that the m_start_time variable will be later than the actual
+ * entries recorded in the file.  In this case, we'll use the creation time
+ * of the file, which should be recorded in the meta-information located on
+ * disk.
+
+ * If we can't use the meta-file, either because it's not there or because
+ * it's not valid, then we'll use timestamp 0 (Jan 1, 1970) as the starting
+ * bound.
+
+ * Return 1 if file rolled, 0 otherwise
+ */
+int
+BaseLogFile::roll(long interval_start, long interval_end)
+

[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682132#comment-14682132
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user SolidWallOfCode commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36772493
  
--- Diff: lib/ts/BaseLogFile.cc ---
@@ -0,0 +1,571 @@
+/** @file
+
+  Base class for log files implementation
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#include "BaseLogFile.h"
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * This is the most common way BaseLogFiles are created.
+ */
+BaseLogFile::BaseLogFile(const char *name)
+  : m_name(ats_strdup(name)), m_hostname(NULL), m_is_regfile(false), 
m_has_signature(false), m_signature(0), m_is_init(false)
+{
+  m_fp = NULL;
+  m_start_time = time(0);
+  m_end_time = 0L;
+  m_bytes_written = 0;
+  m_meta_info = NULL;
+
+  log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n", 
m_name, this);
+}
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * Similar to above constructor, but is overloaded with the object 
signature
+ */
+BaseLogFile::BaseLogFile(const char *name, uint64_t sig)
+  : m_name(ats_strdup(name)), m_hostname(NULL), m_is_regfile(false), 
m_has_signature(true), m_signature(sig), m_is_init(false)
+{
+  m_fp = NULL;
+  m_start_time = time(0);
+  m_end_time = 0L;
+  m_bytes_written = 0;
+  m_meta_info = NULL;
+
+  log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n", 
m_name, this);
+}
+
+/*
+ * This copy constructor creates a BaseLogFile based on a given copy.
+ */
+BaseLogFile::BaseLogFile(const BaseLogFile ©)
+  : m_fp(NULL), m_start_time(copy.m_start_time), m_end_time(0L), 
m_bytes_written(0), m_name(ats_strdup(copy.m_name)),
+m_hostname(ats_strdup(m_hostname)), m_is_regfile(false), 
m_has_signature(copy.m_has_signature), m_signature(copy.m_signature),
+m_is_init(copy.m_is_init), m_meta_info(NULL)
+{
+  log_log_trace("exiting BaseLogFile copy constructor, m_name=%s, 
this=%p\n", m_name, this);
+}
+
+/*
+ * Destructor.
+ */
+BaseLogFile::~BaseLogFile()
+{
+  log_log_trace("entering BaseLogFile destructor, m_name=%s, this=%p\n", 
m_name, this);
+
+  if (m_is_regfile)
+close_file();
+  else
+log_log_trace("not a regular file, not closing, m_name=%s, this=%p\n", 
m_name, this);
+  if (m_name)
+ats_free(m_name);
+  if (m_hostname)
+ats_free(m_hostname);
+
+  log_log_trace("exiting BaseLogFile destructor, this=%p\n", this);
+}
+
+/*
+ * This function is called by a client of BaseLogFile to roll the 
underlying
+ * file  The tricky part to this routine is in coming up with the new file 
name,
+ * which contains the bounding timestamp interval for the entries
+ * within the file.
+
+ * Under normal operating conditions, this BaseLogFile object was in 
existence
+ * for all writes to the file.  In this case, the LogFile members 
m_start_time
+ * and m_end_time will have the starting and ending times for the actual
+ * entries written to the file.
+
+ * On restart situations, it is possible to re-open an existing 
BaseLogFile,
+ * which means that the m_start_time variable will be later than the actual
+ * entries recorded in the file.  In this case, we'll use the creation time
+ * of the file, which should be recorded in the meta-information located on
+ * disk.
+
+ * If we can't use the meta-file, either because it's not there or because
+ * it's not valid, then we'll use timestamp 0 (Jan 1, 1970) as the starting
+ * bound.
+
+ * Return 1 if file rolled, 0 otherwise
+ */
+int
+BaseLogFile::roll(long interval_start, long interval_end)
+

[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682127#comment-14682127
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user SolidWallOfCode commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36772290
  
--- Diff: lib/ts/BaseLogFile.cc ---
@@ -0,0 +1,571 @@
+/** @file
+
+  Base class for log files implementation
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#include "BaseLogFile.h"
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * This is the most common way BaseLogFiles are created.
+ */
+BaseLogFile::BaseLogFile(const char *name)
+  : m_name(ats_strdup(name)), m_hostname(NULL), m_is_regfile(false), 
m_has_signature(false), m_signature(0), m_is_init(false)
+{
+  m_fp = NULL;
+  m_start_time = time(0);
+  m_end_time = 0L;
+  m_bytes_written = 0;
+  m_meta_info = NULL;
+
+  log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n", 
m_name, this);
+}
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * Similar to above constructor, but is overloaded with the object 
signature
+ */
+BaseLogFile::BaseLogFile(const char *name, uint64_t sig)
+  : m_name(ats_strdup(name)), m_hostname(NULL), m_is_regfile(false), 
m_has_signature(true), m_signature(sig), m_is_init(false)
+{
+  m_fp = NULL;
+  m_start_time = time(0);
+  m_end_time = 0L;
+  m_bytes_written = 0;
+  m_meta_info = NULL;
+
+  log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n", 
m_name, this);
+}
+
+/*
+ * This copy constructor creates a BaseLogFile based on a given copy.
+ */
+BaseLogFile::BaseLogFile(const BaseLogFile ©)
+  : m_fp(NULL), m_start_time(copy.m_start_time), m_end_time(0L), 
m_bytes_written(0), m_name(ats_strdup(copy.m_name)),
+m_hostname(ats_strdup(m_hostname)), m_is_regfile(false), 
m_has_signature(copy.m_has_signature), m_signature(copy.m_signature),
+m_is_init(copy.m_is_init), m_meta_info(NULL)
+{
+  log_log_trace("exiting BaseLogFile copy constructor, m_name=%s, 
this=%p\n", m_name, this);
+}
+
+/*
+ * Destructor.
+ */
+BaseLogFile::~BaseLogFile()
+{
+  log_log_trace("entering BaseLogFile destructor, m_name=%s, this=%p\n", 
m_name, this);
+
+  if (m_is_regfile)
+close_file();
+  else
+log_log_trace("not a regular file, not closing, m_name=%s, this=%p\n", 
m_name, this);
+  if (m_name)
+ats_free(m_name);
+  if (m_hostname)
+ats_free(m_hostname);
+
+  log_log_trace("exiting BaseLogFile destructor, this=%p\n", this);
+}
+
+/*
+ * This function is called by a client of BaseLogFile to roll the 
underlying
+ * file  The tricky part to this routine is in coming up with the new file 
name,
+ * which contains the bounding timestamp interval for the entries
+ * within the file.
+
+ * Under normal operating conditions, this BaseLogFile object was in 
existence
+ * for all writes to the file.  In this case, the LogFile members 
m_start_time
+ * and m_end_time will have the starting and ending times for the actual
+ * entries written to the file.
+
+ * On restart situations, it is possible to re-open an existing 
BaseLogFile,
+ * which means that the m_start_time variable will be later than the actual
+ * entries recorded in the file.  In this case, we'll use the creation time
+ * of the file, which should be recorded in the meta-information located on
+ * disk.
+
+ * If we can't use the meta-file, either because it's not there or because
+ * it's not valid, then we'll use timestamp 0 (Jan 1, 1970) as the starting
+ * bound.
+
+ * Return 1 if file rolled, 0 otherwise
+ */
+int
+BaseLogFile::roll(long interval_start, long interval_end)
+

[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682129#comment-14682129
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user danobi commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36772358
  
--- Diff: cmd/traffic_cop/traffic_cop.cc ---
@@ -767,6 +767,26 @@ spawn_manager()
 exit(1);
   }
 
+  // Move any traffic.out that we can not write to, out
+  //  of the way (TSqa2232)
+  // coverity[fs_check_call]
+  if (access(log_file, W_OK) < 0 && errno == EACCES) {
+char old_log_file[PATH_NAME_MAX];
+snprintf(old_log_file, sizeof(old_log_file), "%s.old", log_file);
+// coverity[toctou]
+rename(log_file, old_log_file);
--- End diff --

It looks like whether or not rename() fails or overwrites is implementation 
specific. However, BaseLogFile::open_file() also checks to see if the file can 
be opened, so at the very least the new code's behavior remains consistent with 
the current code. Therefore, I think that the potential renaming problem is 
outside the scope of this issue/patch. 


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682123#comment-14682123
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user SolidWallOfCode commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36772110
  
--- Diff: lib/ts/BaseLogFile.cc ---
@@ -0,0 +1,571 @@
+/** @file
+
+  Base class for log files implementation
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#include "BaseLogFile.h"
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * This is the most common way BaseLogFiles are created.
+ */
+BaseLogFile::BaseLogFile(const char *name)
+  : m_name(ats_strdup(name)), m_hostname(NULL), m_is_regfile(false), 
m_has_signature(false), m_signature(0), m_is_init(false)
+{
+  m_fp = NULL;
+  m_start_time = time(0);
+  m_end_time = 0L;
+  m_bytes_written = 0;
+  m_meta_info = NULL;
+
+  log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n", 
m_name, this);
+}
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * Similar to above constructor, but is overloaded with the object 
signature
+ */
+BaseLogFile::BaseLogFile(const char *name, uint64_t sig)
+  : m_name(ats_strdup(name)), m_hostname(NULL), m_is_regfile(false), 
m_has_signature(true), m_signature(sig), m_is_init(false)
+{
+  m_fp = NULL;
+  m_start_time = time(0);
+  m_end_time = 0L;
+  m_bytes_written = 0;
+  m_meta_info = NULL;
+
+  log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n", 
m_name, this);
+}
+
+/*
+ * This copy constructor creates a BaseLogFile based on a given copy.
+ */
+BaseLogFile::BaseLogFile(const BaseLogFile ©)
+  : m_fp(NULL), m_start_time(copy.m_start_time), m_end_time(0L), 
m_bytes_written(0), m_name(ats_strdup(copy.m_name)),
+m_hostname(ats_strdup(m_hostname)), m_is_regfile(false), 
m_has_signature(copy.m_has_signature), m_signature(copy.m_signature),
+m_is_init(copy.m_is_init), m_meta_info(NULL)
+{
+  log_log_trace("exiting BaseLogFile copy constructor, m_name=%s, 
this=%p\n", m_name, this);
+}
+
+/*
+ * Destructor.
+ */
+BaseLogFile::~BaseLogFile()
+{
+  log_log_trace("entering BaseLogFile destructor, m_name=%s, this=%p\n", 
m_name, this);
+
+  if (m_is_regfile)
+close_file();
+  else
+log_log_trace("not a regular file, not closing, m_name=%s, this=%p\n", 
m_name, this);
+  if (m_name)
+ats_free(m_name);
+  if (m_hostname)
+ats_free(m_hostname);
+
+  log_log_trace("exiting BaseLogFile destructor, this=%p\n", this);
+}
+
+/*
+ * This function is called by a client of BaseLogFile to roll the 
underlying
+ * file  The tricky part to this routine is in coming up with the new file 
name,
+ * which contains the bounding timestamp interval for the entries
+ * within the file.
+
+ * Under normal operating conditions, this BaseLogFile object was in 
existence
+ * for all writes to the file.  In this case, the LogFile members 
m_start_time
+ * and m_end_time will have the starting and ending times for the actual
+ * entries written to the file.
+
+ * On restart situations, it is possible to re-open an existing 
BaseLogFile,
+ * which means that the m_start_time variable will be later than the actual
+ * entries recorded in the file.  In this case, we'll use the creation time
+ * of the file, which should be recorded in the meta-information located on
+ * disk.
+
+ * If we can't use the meta-file, either because it's not there or because
+ * it's not valid, then we'll use timestamp 0 (Jan 1, 1970) as the starting
+ * bound.
+
+ * Return 1 if file rolled, 0 otherwise
+ */
+int
+BaseLogFile::roll(long interval_start, long interval_end)
-

[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682119#comment-14682119
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user SolidWallOfCode commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36771917
  
--- Diff: cmd/traffic_manager/traffic_manager.cc ---
@@ -565,6 +612,25 @@ main(int argc, const char **argv)
 lmgmt->proxy_options = tsArgs;
 mgmt_log(stderr, "[main] Traffic Server Args: '%s'\n", 
lmgmt->proxy_options);
   }
+
+  // we must pass in bind_stdout and bind_stderr values to TS
+  // we do it so TS is able to create BaseLogFiles for each value
+  if (strcmp(bind_stdout, "") != 0) {
+lmgmt->proxy_options =
+  (char *)ats_realloc(lmgmt->proxy_options, 
strlen(lmgmt->proxy_options) + 1 /* space */
+  + strlen("--bind_stdout 
") + strlen(bind_stdout) + 1 /* null term */);
+strcat(lmgmt->proxy_options, " --bind_stdout ");
+strcat(lmgmt->proxy_options, bind_stdout);
+  }
+
+  if (strcmp(bind_stderr, "") != 0) {
--- End diff --

Maybe `0 == *bind_stdout` instead of a function call?


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682114#comment-14682114
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user SolidWallOfCode commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36771629
  
--- Diff: lib/ts/BaseLogFile.cc ---
@@ -0,0 +1,571 @@
+/** @file
+
+  Base class for log files implementation
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#include "BaseLogFile.h"
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * This is the most common way BaseLogFiles are created.
+ */
+BaseLogFile::BaseLogFile(const char *name)
+  : m_name(ats_strdup(name)), m_hostname(NULL), m_is_regfile(false), 
m_has_signature(false), m_signature(0), m_is_init(false)
+{
+  m_fp = NULL;
+  m_start_time = time(0);
+  m_end_time = 0L;
+  m_bytes_written = 0;
+  m_meta_info = NULL;
+
+  log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n", 
m_name, this);
+}
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * Similar to above constructor, but is overloaded with the object 
signature
+ */
+BaseLogFile::BaseLogFile(const char *name, uint64_t sig)
+  : m_name(ats_strdup(name)), m_hostname(NULL), m_is_regfile(false), 
m_has_signature(true), m_signature(sig), m_is_init(false)
+{
+  m_fp = NULL;
+  m_start_time = time(0);
+  m_end_time = 0L;
+  m_bytes_written = 0;
+  m_meta_info = NULL;
+
+  log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n", 
m_name, this);
+}
+
+/*
+ * This copy constructor creates a BaseLogFile based on a given copy.
+ */
+BaseLogFile::BaseLogFile(const BaseLogFile ©)
+  : m_fp(NULL), m_start_time(copy.m_start_time), m_end_time(0L), 
m_bytes_written(0), m_name(ats_strdup(copy.m_name)),
+m_hostname(ats_strdup(m_hostname)), m_is_regfile(false), 
m_has_signature(copy.m_has_signature), m_signature(copy.m_signature),
+m_is_init(copy.m_is_init), m_meta_info(NULL)
+{
+  log_log_trace("exiting BaseLogFile copy constructor, m_name=%s, 
this=%p\n", m_name, this);
+}
+
+/*
+ * Destructor.
+ */
+BaseLogFile::~BaseLogFile()
+{
+  log_log_trace("entering BaseLogFile destructor, m_name=%s, this=%p\n", 
m_name, this);
+
+  if (m_is_regfile)
+close_file();
+  else
+log_log_trace("not a regular file, not closing, m_name=%s, this=%p\n", 
m_name, this);
+  if (m_name)
+ats_free(m_name);
--- End diff --

Did you look at using `ats_scoped_str` for these?


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> wr

[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682109#comment-14682109
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user SolidWallOfCode commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36771496
  
--- Diff: lib/ts/BaseLogFile.cc ---
@@ -0,0 +1,571 @@
+/** @file
+
+  Base class for log files implementation
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#include "BaseLogFile.h"
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * This is the most common way BaseLogFiles are created.
+ */
+BaseLogFile::BaseLogFile(const char *name)
+  : m_name(ats_strdup(name)), m_hostname(NULL), m_is_regfile(false), 
m_has_signature(false), m_signature(0), m_is_init(false)
+{
+  m_fp = NULL;
+  m_start_time = time(0);
+  m_end_time = 0L;
+  m_bytes_written = 0;
+  m_meta_info = NULL;
+
+  log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n", 
m_name, this);
+}
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * Similar to above constructor, but is overloaded with the object 
signature
+ */
+BaseLogFile::BaseLogFile(const char *name, uint64_t sig)
--- End diff --

Comments on this and the previous constructor.
Why aren't these all member initializers? E.g. `m_fp = NULL:` instead of `: 
m_fp(NULL)`?
Also, for constructors this similar it's probably better to only have the 2 
argument form with a default value for the second one.


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682111#comment-14682111
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user SolidWallOfCode commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36771572
  
--- Diff: lib/ts/BaseLogFile.cc ---
@@ -0,0 +1,571 @@
+/** @file
+
+  Base class for log files implementation
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#include "BaseLogFile.h"
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * This is the most common way BaseLogFiles are created.
+ */
+BaseLogFile::BaseLogFile(const char *name)
+  : m_name(ats_strdup(name)), m_hostname(NULL), m_is_regfile(false), 
m_has_signature(false), m_signature(0), m_is_init(false)
+{
+  m_fp = NULL;
+  m_start_time = time(0);
+  m_end_time = 0L;
+  m_bytes_written = 0;
+  m_meta_info = NULL;
+
+  log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n", 
m_name, this);
+}
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * Similar to above constructor, but is overloaded with the object 
signature
+ */
+BaseLogFile::BaseLogFile(const char *name, uint64_t sig)
+  : m_name(ats_strdup(name)), m_hostname(NULL), m_is_regfile(false), 
m_has_signature(true), m_signature(sig), m_is_init(false)
+{
+  m_fp = NULL;
+  m_start_time = time(0);
+  m_end_time = 0L;
+  m_bytes_written = 0;
+  m_meta_info = NULL;
+
+  log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n", 
m_name, this);
+}
+
+/*
+ * This copy constructor creates a BaseLogFile based on a given copy.
+ */
+BaseLogFile::BaseLogFile(const BaseLogFile ©)
+  : m_fp(NULL), m_start_time(copy.m_start_time), m_end_time(0L), 
m_bytes_written(0), m_name(ats_strdup(copy.m_name)),
+m_hostname(ats_strdup(m_hostname)), m_is_regfile(false), 
m_has_signature(copy.m_has_signature), m_signature(copy.m_signature),
--- End diff --

`m_hostname(ats_strdup(m_hostname))` - what is this trying to do?


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682089#comment-14682089
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user SolidWallOfCode commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36770431
  
--- Diff: iocore/net/test_certlookup.cc ---
@@ -206,7 +206,8 @@ SSLReleaseContext(SSL_CTX *ctx)
 int
 main(int argc, const char **argv)
 {
-  diags = new Diags(NULL, NULL, stdout);
+  BaseLogFile *blf = new BaseLogFile("stdout");
+  diags = new Diags(NULL, NULL, blf);
--- End diff --

I see this pattern a lot. Maybe `Diags` should have a constructor overload 
that takes a string and does the `BaseLogFile` construction.


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682085#comment-14682085
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user danobi commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36770248
  
--- Diff: cmd/traffic_crashlog/Makefile.am ---
@@ -20,6 +20,7 @@ bin_PROGRAMS = traffic_crashlog
 AM_CPPFLAGS = \
   $(iocore_include_dirs) \
   -I$(top_srcdir)/lib \
+  -I$(top_srcdir)/lib/ts \
--- End diff --

I'll see if I can change this. Originally I just wanted it to compile. 


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682084#comment-14682084
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user danobi commented on the pull request:

https://github.com/apache/trafficserver/pull/274#issuecomment-129969889
  
There are a few reasons:
- It makes sense from the user perspective, since they can already control 
rotation from records.config of the access & error logs
- We have the same functionality already; most of the changes are 
restructuring things
- The current implementation of logging to traffic.out is dubious; with 
this we gain more flexibility and control


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682083#comment-14682083
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user SolidWallOfCode commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36769922
  
--- Diff: iocore/eventsystem/test_Event.cc ---
@@ -91,23 +91,13 @@ reconfigure_diags()
 static void
 init_diags(const char *bdt, const char *bat)
 {
-  FILE *diags_log_fp;
   char diags_logpath[500];
   strcpy(diags_logpath, DIAGS_LOG_FILE);
 
-  diags_log_fp = fopen(diags_logpath, "w");
-  if (diags_log_fp) {
-int status;
-status = setvbuf(diags_log_fp, NULL, _IOLBF, 512);
-if (status != 0) {
-  fclose(diags_log_fp);
-  diags_log_fp = NULL;
-}
-  }
-
-  diags = new Diags(bdt, bat, diags_log_fp);
+  BaseLogFile *blf = new BaseLogFile(diags_logpath);
+  diags = new Diags(bdt, bat, blf);
 
-  if (diags_log_fp == NULL) {
+  if (blf && blf->m_fp == NULL) {
--- End diff --

How can `blf` be `NULL` since you just allocated it? And in that case the 
condition should be `NULL == blf || NULL == blf->m_fp` because if `blf` is NULL 
you're failed as well.


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682032#comment-14682032
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user jpeach commented on the pull request:

https://github.com/apache/trafficserver/pull/274#issuecomment-129955776
  
Can you explain why we need this, rather than adding better support for 
something like log rotate?


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682026#comment-14682026
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user SolidWallOfCode commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36765118
  
--- Diff: cmd/traffic_crashlog/Makefile.am ---
@@ -20,6 +20,7 @@ bin_PROGRAMS = traffic_crashlog
 AM_CPPFLAGS = \
   $(iocore_include_dirs) \
   -I$(top_srcdir)/lib \
+  -I$(top_srcdir)/lib/ts \
--- End diff --

Why was this added back in? There was a bug specifically to get rid of that 
(TS-3759).


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682020#comment-14682020
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user SolidWallOfCode commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36764670
  
--- Diff: cmd/traffic_crashlog/traffic_crashlog.cc ---
@@ -91,7 +92,8 @@ main(int /* argc ATS_UNUSED */, const char **argv)
   crashlog_target target;
   pid_t parent = getppid();
 
-  diags = new Diags("" /* tags */, "" /* actions */, stderr);
+  BaseLogFile *base_log_file = new BaseLogFile("stderr");
--- End diff --

Why declare `base_log_file`? Just pass `new BaseLogFIle("stderr")` directly 
to `Diags` constructor.


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682009#comment-14682009
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user SolidWallOfCode commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36763807
  
--- Diff: cmd/traffic_cop/traffic_cop.cc ---
@@ -767,6 +767,26 @@ spawn_manager()
 exit(1);
   }
 
+  // Move any traffic.out that we can not write to, out
+  //  of the way (TSqa2232)
+  // coverity[fs_check_call]
+  if (access(log_file, W_OK) < 0 && errno == EACCES) {
+char old_log_file[PATH_NAME_MAX];
+snprintf(old_log_file, sizeof(old_log_file), "%s.old", log_file);
+// coverity[toctou]
+rename(log_file, old_log_file);
--- End diff --

Can the rename fail if there is already a .old version?


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-10 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14680384#comment-14680384
 ] 

ASF GitHub Bot commented on TS-306:
---

Github user bellofreedom commented on a diff in the pull request:

https://github.com/apache/trafficserver/pull/274#discussion_r36656961
  
--- Diff: proxy/shared/Makefile.am ---
@@ -26,6 +26,8 @@ noinst_LIBRARIES = \
 AM_CPPFLAGS = \
   $(iocore_include_dirs) \
   -I$(top_srcdir)/lib/records \
+   -I$(top_srcdir)/lib/ts \
--- End diff --

indent


> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-08-07 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14662592#comment-14662592
 ] 

ASF GitHub Bot commented on TS-306:
---

GitHub user danobi opened a pull request:

https://github.com/apache/trafficserver/pull/274

TS-306 Enable log rotation for diags.log & traffic.out

- The commit message contains an architectural overview of this feature
- 'make test' and './traffic_server -R 1' all pass right now
- Manual testing yields correct rotational behavior and unchanged behavior 
to access & error logs (eg. squid.log, error.log, etc)
- Documentation is coming soon

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/danobi/trafficserver log-rotation-squashed

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/trafficserver/pull/274.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #274


commit 7be0a0d7f44505af2d2aa5e2ce85fb7e8c478a9e
Author: Daniel Xu 
Date:   2015-07-13T23:07:30Z

TS-306 Enable log rotation for diags.log & traffic.out

This feature provides the ability to rotate any log that
is created by the Diags (including diags.log and
manager.log) class, as well as traffic.out (the
output log). These logs can be rotated either by
time or by size, and both of these options can be
specified in records.config [see documentation].
While the feature is relatively small, it required
a rather large number of internal changes. Therefore,
the _rest_ of this commit message will be a high
level architectural overview of the changes
necessitated by this feature.

The class, BaseLogFile, is added and it is intended
to be an abstraction for files on disk as well as
the stdout/stderr stream. BaseLogFile is used by
both LogFile and Diags to help control individual
log files. For Diags, each BaseLogFile is created by
DiagsConfig. DiagsConfig also sets a few more values
unavailable to Diags. LogFile uses BaseLogFile to
manage actual files on disk. In some rare cases, LogFile
also uses BaseLogFile to manage a stdout or stderr
stream. Most of the functionality in BaseLogFile was
stripped from LogFile and moved into BaseLogFile.

Originally, traffic.out was just a file whose file
descriptor was dup2()’d from traffic_cop all the way to
traffic_server (by way of fork()/exec()). With this
patch, traffic_cop spawns the traffic_manager process
with the location of traffic.out specified as flags
(—-bind_stdout and -—bind_stderr). traffic_manager
creates two BaseLogFile objects, one for each stdout
and stderr, both mapped to traffic.out. traffic_manager
then spawns the traffic_server process with the same
flags, and traffic_server creates two BaseLogFiles in
a similar fashion.

As for the actual rotation, traffic_manager checks
to see if traffic.out needs to be rotated once per
iteration of traffic_manager’s main loop. As soon
as traffic_manager rotates traffic.out, SIGUSR2 is
sent from traffic_manager to traffic_server, and
traffic_server catches SIGUSR2 and synchronizes its
own BaseLogFiles with the newly created
traffic.out file on disk.

For rotation of diags.log, a continuation is
scheduled every second in traffic_server to see if
diags.log needs rotation, and then proceeds to
rotate if necessary. manager.log is checked for
rotation right after traffic.out is checked for
rotation in the main loop of traffic_manager.




> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> 

[jira] [Commented] (TS-306) enable log rotation for diags.log

2015-07-08 Thread Daniel Xu (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14618906#comment-14618906
 ] 

Daniel Xu commented on TS-306:
--

RFC on implementation plan:

- Create an independent base class with a lot of the functionality from LogFile 
(file rotation, byte tracking, timestamps, etc)
- Make LogFile inherit from the base class
- Make Diags use the base class to manage diags.log and traffic.out

A major benefit of this plan is that no code needs to be copied and pasted. It 
would also be very easy to add new basic functionality for log files. 
Drawbacks include more complexity and a mixing of what are two different types 
of logging systems. 

I'm mainly looking for design critique. 

> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Assignee: Daniel Xu
>  Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2014-09-12 Thread James Peach (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14131672#comment-14131672
 ] 

James Peach commented on TS-306:


Rotation of {{diags.log}} should work the same as rotation for all the other 
logs.

> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Priority: Critical
> Fix For: 5.3.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2014-09-12 Thread kang li (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14131326#comment-14131326
 ] 

kang li commented on TS-306:


I'm now working at this issue. There are two common ways to do log rotation.

1. Use pipe for log rotation
Pro:
Easy to configure
Could take advantage of several logging tools, ie. cronolog, multilog.
Con:
Need additional processes to do logging.

2. Use logrotate for log rotation
Pro:
System level log rotation management.
Con:
Need extra configuration.
Need to figure out how to reload log files.

I prefer to use pipe to do log rotation as it’s easy to use. Is there any 
concern for the pipe file? Any suggestions would be appreciated.

Comment from [~bcall]:
I would lean towards using inotify/kqueue to see if the file has been removed 
or renamed and then reopen the file.  There is more overhead and more 
complexity with the external tools with the pipe approach.

-Bryan

> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Priority: Critical
> Fix For: 5.3.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TS-306) enable log rotation for diags.log

2013-09-18 Thread Yunkai Zhang (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13770525#comment-13770525
 ] 

Yunkai Zhang commented on TS-306:
-

[~zwoop]:

Can diags.out be rolled now? (It seems not)

> enable log rotation for diags.log
> -
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Logging
>Reporter: Miles Libbey
>Priority: Critical
> Fix For: sometime
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used 
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by 
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>   
>  
> Comment 1
>  by Joseph Rothrock  2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>   
> Comment 2
>  by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though 
> rotation is turned on. This is
> counter-intuitive.  Rotation does not control traffic.out, but a large 
> traffic.out will stop error.log from being
> written.
>   

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira