[Zodb-checkins] CVS: ZODB3/ZODB - lock_file.py:1.10

Jeremy Hylton jeremy at zope.com
Wed Feb 4 14:36:29 EST 2004


Update of /cvs-repository/ZODB3/ZODB
In directory cvs.zope.org:/tmp/cvs-serv29123

Modified Files:
	lock_file.py 
Log Message:
Log error if we fail to lock file.


=== ZODB3/ZODB/lock_file.py 1.9 => 1.10 ===
--- ZODB3/ZODB/lock_file.py:1.9	Tue Apr  8 14:48:22 2003
+++ ZODB3/ZODB/lock_file.py	Wed Feb  4 14:36:28 2004
@@ -14,6 +14,7 @@
 
 import os
 import errno
+import logging
 
 try:
     import fcntl
@@ -45,6 +46,7 @@
         # File is automatically unlocked on close
         pass
 
+log = logging.getLogger("LockFile")
 
 
 # This is a better interface to use than the lockfile.lock_file() interface.
@@ -59,7 +61,11 @@
             if e.errno <> errno.ENOENT: raise
             self._fp = open(path, 'w+')
         # Acquire the lock and piss on the hydrant
-        lock_file(self._fp)
+        try:
+            lock_file(self._fp)
+        except:
+            log.exception("Error locking file %s" % path)
+            raise
         print >> self._fp, os.getpid()
         self._fp.flush()
 




More information about the Zodb-checkins mailing list