From: Vinay Sajip on
On Apr 8, 1:58 pm, Rebelo <puntabl...(a)gmail.com> wrote:
> 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
> > alogginghandler.
>
> > Regards,
>
> > Vinay Sajip
>
> thnx for help.
> writing to a file works, but i needlogging.
> do you know where can i find good documnetation for python-daemon?

No,

but see this post:

http://groups.google.com/group/comp.lang.python/msg/851ce78e53812ade

It may lead you to more information. The thread shows that Sean
DiZazzo got logging working with the package.

I think you just have to pass the file object used by the handler
(fh.stream) in the files_preserve array.

Regards,

Vinay Sajip
From: Rebelo on
i found a crude workaround:
i wrote a function in which i start logging after deamon starts
From: Rebelo on
Vinay Sajip wrote:
> On Apr 8, 1:58 pm, Rebelo <puntabl...(a)gmail.com> wrote:
>> 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
>>> alogginghandler.
>>> Regards,
>>> Vinay Sajip
>> thnx for help.
>> writing to a file works, but i needlogging.
>> do you know where can i find good documnetation for python-daemon?
>
> No,
>
> but see this post:
>
> http://groups.google.com/group/comp.lang.python/msg/851ce78e53812ade
>
> It may lead you to more information. The thread shows that Sean
> DiZazzo got logging working with the package.
>
> I think you just have to pass the file object used by the handler
> (fh.stream) in the files_preserve array.
>
> Regards,
>
> Vinay Sajip
thank you.
From: Ben Finney on
Rebelo <puntabluda(a)gmail.com> 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 intended to address.

Hopefully you can make use of the 'DaemonContext.files_preserve' option
as intended; please see my message earlier in this thread.

--
\ “Of all classes the rich are the most noticed and the least |
`\ studied.” —John Kenneth Galbraith, _The Age of Uncertainty_, |
_o__) 1977 |
Ben Finney