Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 48499 - Path in apache2splitlogfile error message incorrect
Summary: Path in apache2splitlogfile error message incorrect
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Linux
: High trivial (vote)
Assignee: Apache Team - Bugzilla Reports
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-20 12:32 UTC by Ryan Schmidt
Modified: 2005-09-22 04:57 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
tiny patch to fix this bug (2.0.50-rcs.diff,501 bytes, patch)
2004-07-20 03:47 UTC, Ryan Schmidt
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan Schmidt 2004-04-20 12:32:26 UTC
Hello. Line 109 of apache2splitlogfile has an error. Lines 108 and 109 are as follows:

    open LOGFILE, ">>$filename"
            or die ("Can't open $logs/$filename");

Line 109 should just say "Can't open $filename"; it should not include "$logs" in the string. This is 
because of line 104, which reads:

    $filename="$logs/VLOG-$date-${vhost}.log";

See? $logs is already part of $filename.

As a result, my error log has paths in it which are confusing, because the directory part is printed twice. 
This perhaps leads me to incorrect conclusions about the source of my misconfiguration.

I submitted this bug to the Apache group but they informed me that the Gentoo team has made these modifications to the file, so I am submitting the bug report to you. Here's the original one I filed with Apache:

http://issues.apache.org/bugzilla/show_bug.cgi?id=28500

Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1 Chuck Short (RETIRED) gentoo-dev 2004-04-21 18:44:00 UTC
Are you using the standard error_logs? Also submitting a patch would be great.

Thanks
zul
Comment 2 Chuck Short (RETIRED) gentoo-dev 2004-04-21 18:54:38 UTC
Never mind I see where you are coming from. Fixed in cvs.

Thanks for the bug report.

chuck 
Comment 3 Ryan Schmidt 2004-07-20 03:42:56 UTC
The bug does not appear to have been fixed. We have Apache 2.0.50 and the file still has the problem described in this report. I will attach a diff with which you can fix it.
Comment 4 Ryan Schmidt 2004-07-20 03:47:50 UTC
Created attachment 35803 [details, diff]
tiny patch to fix this bug
Comment 5 Benedikt Böhm (RETIRED) gentoo-dev 2004-10-27 10:56:10 UTC
i fixed that in our svn overlay
Comment 6 Benedikt Böhm (RETIRED) gentoo-dev 2005-01-19 23:18:06 UTC
ok, this is now in portage
Comment 7 Albert Lash 2005-09-22 04:48:47 UTC
This bug is still alive. I installed a fresh Gentoo, Apache2 in August 2005 and
it has this problem. 

    open LOGFILE, ">>$filename"
            or die ("Can't open $logs/$filename");

Should be: 

    open LOGFILE, ">>$filename"
            or die ("Can't open $filename");

Also, as is, it doesn't die very gracefully. I recommend changing it to this:

    open (LOGFILE, ">>$filename")
            or die ("Can't open $logs/$filename");

Occasionally I get a problematic log entry that will result in a $logs equal to
"-", causing this script to fail. The only way I can reproduce it reliably is to
use a mod_rewrite redirect. I have included another line in this script to
handle these anomolies: 

if($logs eq "-") {$logs="/var/log/apache2";}

right after the similar existing line: 

if($logs eq "") {$logs="/var/log/apache2";}

as the comments say: "caution rocks"
Comment 8 Albert Lash 2005-09-22 04:57:48 UTC
(In reply to comment #7)
> This bug is still alive. I installed a fresh Gentoo, Apache2 in August 2005 and
> it has this problem. 
> 
>     open LOGFILE, ">>$filename"
>             or die ("Can't open $logs/$filename");
> 
> Should be: 
> 
>     open LOGFILE, ">>$filename"
>             or die ("Can't open $filename");
> 
> Also, as is, it doesn't die very gracefully. I recommend changing it to this:
> 
>     open (LOGFILE, ">>$filename")
>             or die ("Can't open $logs/$filename");
> 
> Occasionally I get a problematic log entry that will result in a $logs equal to
> "-", causing this script to fail. The only way I can reproduce it reliably is to
> use a mod_rewrite redirect. I have included another line in this script to
> handle these anomolies: 
> 
> if($logs eq "-") {$logs="/var/log/apache2";}
> 
> right after the similar existing line: 
> 
> if($logs eq "") {$logs="/var/log/apache2";}
> 
> as the comments say: "caution rocks"

In addition, I've seen some replacement scripts to this one that close the
logfile when finished, would this help? Like: 

http://files.l8nite.net/apache2_splitlog/apache2_splitlog.txt