Re: daemon.DaemonContext and logging

2014-05-22 Thread Mark H Harris
On 5/22/14 10:28 AM, wo...@4amlunch.net wrote: On Saturday, April 10, 2010 11:52:41 PM UTC-4, Ben Finney wrote: pid = daemon.pidlockfile.TimeoutPIDLockFile( "/tmp/dizazzo-daemontest.pid", 10) Has pidlockfile been removed? (1.6) -brian "Have you released the inertial dampener?

Re: daemon.DaemonContext

2014-05-22 Thread Ethan Furman
On 05/22/2014 07:31 AM, wo...@4amlunch.net wrote: I know it's 4 years later, but I'm currently battling this myself. I do exactly this and yet it doesn't appear to be keeping the filehandler open. Nothing ever gets written to logs after I daemonize! You didn't include any context (important a

Re: daemon.DaemonContext

2014-05-22 Thread wonko
onize! Ok, made it work, although I think this goes against the documentation as well as what's here. I changed: context = daemon.DaemonContext( # Stuff here ) context.files_preserve[fh.stream] to: context = daemon.DaemonContext( # Stuff here files_preserve[fh.stream] )

Re: daemon.DaemonContext and logging

2014-05-22 Thread wonko
On Saturday, April 10, 2010 11:52:41 PM UTC-4, Ben Finney wrote: > pid = daemon.pidlockfile.TimeoutPIDLockFile( > "/tmp/dizazzo-daemontest.pid", 10) Has pidlockfile been removed? (1.6) -brian -- https://mail.python.org/mailman/listinfo/python-list

Re: daemon.DaemonContext

2014-05-22 Thread wonko
I know it's 4 years later, but I'm currently battling this myself. I do exactly this and yet it doesn't appear to be keeping the filehandler open. Nothing ever gets written to logs after I daemonize! -- https://mail.python.org/mailman/listinfo/python-list

Re: daemon.DaemonContext and logging

2010-04-10 Thread Ben Finney
Sean DiZazzo writes: > I'm finally getting around to trying out the python-daemon module and > have hit a wall. I'm trying to set up logging inside of the "with > daemon.DaemonContext" block. But when I try to use a logger inside > the block it throws an error:

Re: Preserving logging streams through a daemon.DaemonContext switch

2010-04-09 Thread Ben Finney
Vinay Sajip writes: > On Apr 9, 12:46 am, Ben Finney wrote: > > Not quite. As the docs specify, you need to pass the *file > > descriptors* for the files you want preserved. > > Okay, but the docstring you quoted: > > "Elements of the list are file descriptors (as returned by a file > object's `

Re: Preserving logging streams through a daemon.DaemonContext switch (was: daemon.DaemonContext)

2010-04-09 Thread Vinay Sajip
On Apr 9, 12:46 am, Ben Finney wrote: > > I think you just have to pass the file object used by the handler > > (fh.stream) in the files_preserve array. > > Not quite. As the docs specify, you need to pass the *file descriptors* > for the files you want preserved. Okay, but the docstring you quot

Re: Preserving logging streams through a daemon.DaemonContext switch

2010-04-08 Thread Rebelo
Ben Finney wrote: Vinay Sajip writes: On Apr 8, 1:58 pm, Rebelo wrote: Vinay Sajip wrote: My guess is - files_preserve needs to be passed a file handle and not alogginghandler. This is correct. As the ‘DaemonContext.__init__’ docstring says:: | `files_preserve` | :Default: ``None

Re: daemon.DaemonContext

2010-04-08 Thread Ben Finney
Rebelo writes: > i found a crude workaround: > i wrote a function in which i start logging after deamon starts That seems rather sub-optimal; you'll be unable to use the logger for anything before the daemon context opens. This kind of problem is exactly what ‘DaemonContext.files_preserve’ is in

Preserving logging streams through a daemon.DaemonContext switch (was: daemon.DaemonContext)

2010-04-08 Thread Ben Finney
Vinay Sajip writes: > On Apr 8, 1:58 pm, Rebelo wrote: > > Vinay Sajip wrote: > > > My guess is - files_preserve needs to be passed a file handle and > > > not alogginghandler. This is correct. As the ‘DaemonContext.__init__’ docstring says:: | `files_preserve` | :Default: ``None`` |

Re: daemon.DaemonContext

2010-04-08 Thread Rebelo
Vinay Sajip wrote: On Apr 8, 1:58 pm, Rebelo wrote: Vinay Sajip wrote: On Apr 8, 1:28 pm, Rebelo wrote: when i use this : context = daemon.DaemonContext(stdin=sys.stdin, stdout=sys.stdout, files_preserve=[fh], signal_map = {signal.SIGTERM: 'terminate',signal.SIGHUP: 'termi

Re: daemon.DaemonContext

2010-04-08 Thread Rebelo
i found a crude workaround: i wrote a function in which i start logging after deamon starts -- http://mail.python.org/mailman/listinfo/python-list

Re: daemon.DaemonContext

2010-04-08 Thread Vinay Sajip
On Apr 8, 1:58 pm, Rebelo wrote: > Vinay Sajip wrote: > > On Apr 8, 1:28 pm, Rebelo wrote: > >> when i use this : > >>  context = daemon.DaemonContext(stdin=sys.stdin, stdout=sys.stdout, > >> files_preserve=[fh], signal_map = {signal.SIGTERM: > &

Re: daemon.DaemonContext

2010-04-08 Thread Rebelo
Vinay Sajip wrote: On Apr 8, 1:28 pm, Rebelo 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'

Re: daemon.DaemonContext

2010-04-08 Thread Vinay Sajip
On Apr 8, 1:28 pm, Rebelo 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 stil

Re: daemon.DaemonContext

2010-04-08 Thread Vinay Sajip
On Apr 8, 1:28 pm, Rebelo 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 stil

Re: daemon.DaemonContext

2010-04-08 Thread Rebelo
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? --

daemon.DaemonContext

2010-04-08 Thread Rebelo
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=[f

New user documentation for ‘python-daemon ’ (was: daemon.DaemonContext and logging)

2009-12-10 Thread Ben Finney
Sean DiZazzo writes: > On Dec 10, 5:37 pm, Sean DiZazzo wrote: > > I'm finally getting around to trying out the python-daemon module > > and have hit a wall.  I'm trying to set up logging inside of the > > "with daemon.DaemonContext" block.  But when I

Re: daemon.DaemonContext and logging

2009-12-10 Thread Sean DiZazzo
On Dec 10, 5:37 pm, Sean DiZazzo wrote: > I'm finally getting around to trying out the python-daemon module and > have hit a wall.  I'm trying to set up logging inside of the "with > daemon.DaemonContext" block.  But when I try to use a logger inside > the block i

daemon.DaemonContext and logging

2009-12-10 Thread Sean DiZazzo
I'm finally getting around to trying out the python-daemon module and have hit a wall. I'm trying to set up logging inside of the "with daemon.DaemonContext" block. But when I try to use a logger inside the block it throws an error: ~~ fr