When logging is enabled, web pages display "Unable to write to log"
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ampache (Ubuntu) |
Fix Released
|
Undecided
|
Charlie_Smotherman |
Bug Description
I've installed Ampache from the Ubuntu Maverick repository (version 3.5.4-7ubuntu1). It has a problem, though. When I visit my "ampache" web site, hosted in Apache 2.2 (also from the repository), each page is plastered with messages like:
Unable to write to log (/var/log/
This problem occurs only once I enabled logging through ampache.cfg.php:
debug="true";
log_
It also only happens after the system has been sitting for a day (so that the daily catalog update job gets run). Even then it's not for certain. The update job has to run first that day; if the web site gets hit first, then all is fine.
My web site is not public, but you can see identical behaviour on this site, which I found through Google (nothing to do with me):
http://
** Warning ** you're likely violating someone's intellectual property rights if you actually try to play a song from this site.
The underlying problem is that the log file is created each day by user/group root/root, but Apache of course runs as user/group www-data/www-data. My guess as to why this happens is because ampache is set up with a cron job as well, and it's creating the log file first (as it is a php script that pulls in the same Ampache configuration script). Here are some directory lists to show the log file situation:
drwxrwxr-x 3 www-data www-data 12288 2011-02-20 12:45 /var/log/ampache
-rw-r--r-- 1 root root 6537 2011-02-15 22:06 /var/log/
-rw-r--r-- 1 root root 582053 2011-02-15 22:06 /var/log/
A possible solution is to replace the command at the end of /etc/cron.
logowner=$(ls -dl /var/log/ampache | sed 's/^d......... [0-9]\+ \([^ ]\+\) .*/\1/')
sudo -u ${logowner} php /usr/share/
Changed in ampache (Ubuntu): | |
status: | New → In Progress |
assignee: | nobody → Charlie_Smotherman (porthose) (cjsmo) |
Jim,
Thank you for the bug report.
If you have a look at 3.5.4-8ubuntu1, I have setup the package maintainer scripts to set /var/log/ampache to be owned by www-data:www-data, and so far I have not had any problems with ampache writing to logs even when manually invoking /usr/share/ ampache/ www/bin/ catalog_ update. inc. I also patched log.lib.php to remove the date so ampache only creates ampache-catalog.log and ampache.log for some reason logrotate was chocking on the date being in the log file name.
http:// bazaar. launchpad. net/~ubuntu- branches/ ubuntu/ natty/ampache/ natty/view/ head:/debian/ patches/ logrotate_ fix.patch
So the net result is that www-data owns /var/log/ampache, log.lib.php has been patched to remove the date in the log file names, ampache continually appends ampache.log, and ampache-catalog.log until logrotate grabs ampache.log and ampache- catalog. log, ranames and compresses the log files, logrotate has been setup to rotate the logs daily with logs older that 7days get deleted/shredded.
Actually this bug should be set to fixed-released (since this has been fixed in the current development branch) but I would like to keep it open for further discussion.
There is a sync request for 3.5.4-11 to be synced over from debian.
https:/ /bugs.launchpad .net/ubuntu/ +source/ ampache/ +bug/721412