Bugs item #1367814, was opened at 2005-11-27 23:31 Message generated for change (Settings changed) made by vsajip You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1367814&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Python 2.4 >Status: Closed >Resolution: Invalid Priority: 5 Submitted By: Chris Fuller (cfuller) Assigned to: Nobody/Anonymous (nobody) Summary: loogger module locks Initial Comment: I have an application that uses the logger functionality, and the RotatingFileHandler class. If my application is running, and another instance is launched, it fails at the rollover step. I don't want multiple instances running at once, so this is fine, and even general, since the rollover must occur if an instance is already running. Rather than checking for a generic I/O error, however, I'd like to use some sort of locking mechanism that is less opaque. The locking provided won't work, since it is blocking only: the application deadlocks if one ias runnning already. Why doesn't it work like a normal Lock() instance and take a blocking parameter? I could use locking via the portalocker module from the python cookbook (hmm, portable file locking would be a nice thing to have in the standard library, the logger module already does it anyway!) but I can't find anyway to access the file descriptor! Sure, I could workaround that. I could create a RotatingFileHandler instance, roll over, close it, open the file, pass it to StreamHandler, but python is way more elegant than that. For now, I'll just trap the rollover. Still very cool stuff! ---------------------------------------------------------------------- >Comment By: Vinay Sajip (vsajip) Date: 2005-12-15 09:06 Message: Logged In: YES user_id=308438 Closing, as this does not appear to be a bug report. Thanks for your comments. My advice (if you have multiple processes logging to the same file) is to add a separate logging process (or perhaps a thread in one of the processes) which receives logging events from a socket and logs to files. This way, there is no contention for the file. See http://docs.python.org/lib/network-logging.html ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1367814&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com