From: Rebelo on 8 Apr 2010 08:14 i get : IOError: [Errno 9] Bad file descriptor when i have logging and using daemon.DaemonContext() i tried passing : fh = logging.handlers.TimedRotatingFileHandler(LOG_FILENAME, 'midnight', encoding='utf-8') with : context = daemon.DaemonContext() context.files_preserve=[fh] but no good what am i doing wrong?
From: Rebelo on 8 Apr 2010 08:28 when i use this : context = daemon.DaemonContext(stdin=sys.stdin, stdout=sys.stdout, files_preserve=[fh], signal_map = {signal.SIGTERM: 'terminate',signal.SIGHUP: 'terminate'}) i don't get error but i still can't write to log file what am i doing wrong?
From: Vinay Sajip on 8 Apr 2010 08:45 On Apr 8, 1:28 pm, Rebelo <puntabl...(a)gmail.com> wrote: > when i use this : > context = daemon.DaemonContext(stdin=sys.stdin, stdout=sys.stdout, > files_preserve=[fh], signal_map = {signal.SIGTERM: > 'terminate',signal.SIGHUP: 'terminate'}) > > i don't get error but i still can't write to log file > what am i doing wrong? Not sure, offhand. Change to a script which just writes to the file (rather than going via logging) - does that work? What platform are you on, what version etc? It's unlikely to be a logging-related problem: more likely it's to do with file descriptors. Regards, Vinay Sajip
From: Vinay Sajip on 8 Apr 2010 08:50 On Apr 8, 1:28 pm, Rebelo <puntabl...(a)gmail.com> wrote: > when i use this : > context = daemon.DaemonContext(stdin=sys.stdin, stdout=sys.stdout, > files_preserve=[fh], signal_map = {signal.SIGTERM: > 'terminate',signal.SIGHUP: 'terminate'}) > > i don't get error but i still can't write to log file > what am i doing wrong? My guess is - files_preserve needs to be passed a file handle and not a logging handler. Regards, Vinay Sajip
From: Rebelo on 8 Apr 2010 08:58 Vinay Sajip wrote: > On Apr 8, 1:28 pm, Rebelo <puntabl...(a)gmail.com> wrote: >> when i use this : >> context = daemon.DaemonContext(stdin=sys.stdin, stdout=sys.stdout, >> files_preserve=[fh], signal_map = {signal.SIGTERM: >> 'terminate',signal.SIGHUP: 'terminate'}) >> >> i don't get error but i still can't write to log file >> what am i doing wrong? > > My guess is - files_preserve needs to be passed a file handle and not > a logging handler. > > Regards, > > Vinay Sajip thnx for help. writing to a file works, but i need logging. do you know where can i find good documnetation for python-daemon?
|
Next
|
Last
Pages: 1 2 Prev: raise exception with fake filename and linenumber Next: get objects from image |