changeset 5690:1b365c5723bc

server: append to logfiles
author Mirko Friedenhagen <mirko-lists@friedenhagen.de>
date Mon, 24 Dec 2007 17:21:40 +0100
parents c2d0ed7f4af8
children 8e495dd6662e
files mercurial/hgweb/server.py tests/test-hgweb tests/test-hgweb.out
diffstat 3 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/server.py	Mon Dec 24 12:22:33 2007 +0100
+++ b/mercurial/hgweb/server.py	Mon Dec 24 17:21:40 2007 +0100
@@ -197,7 +197,7 @@
 
     def openlog(opt, default):
         if opt and opt != '-':
-            return open(opt, 'w')
+            return open(opt, 'a')
         return default
 
     if repo is None:
--- a/tests/test-hgweb	Mon Dec 24 12:22:33 2007 +0100
+++ b/tests/test-hgweb	Mon Dec 24 17:21:40 2007 +0100
@@ -7,7 +7,7 @@
 echo foo > da/foo
 echo foo > foo
 hg ci -Ambase -d '0 0'
-hg serve -p $HGPORT -d --pid-file=hg.pid
+hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log
 cat hg.pid >> $DAEMON_PIDS
 echo % manifest
 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/?style=raw')
@@ -28,5 +28,12 @@
 echo % should give a 404 - file does not exist
 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/bork?style=raw'
 
+echo % stop and restart
+kill `cat hg.pid`
+hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log
+cat hg.pid >> $DAEMON_PIDS
+# Test the access/error files are opened in append mode
+python -c "print len(file('access.log').readlines()), 'log lines written'"
+
 echo % static file
 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/static/style-gitweb.css'
--- a/tests/test-hgweb.out	Mon Dec 24 12:22:33 2007 +0100
+++ b/tests/test-hgweb.out	Mon Dec 24 17:21:40 2007 +0100
@@ -65,6 +65,8 @@
 
 
 error: Path not found: bork/
+% stop and restart
+7 log lines written
 % static file
 200 Script output follows