Daemon and logging - the best approach?
Neal Becker
ndbecker2 at gmail.com
Fri Nov 7 14:30:41 EST 2008
Lech Karol Pawłaszek wrote:
> Hello.
>
> I'm trying to make a daemon and I want to log to a file its activity.
> I'm using logging module with a configuration file for it (loaded via
> fileConfig()).
>
> And now I want to read logging config file before daemonize the program
> because the file might not be accessible after daemonization. OTOH while
> daemonizing I am closing all opened file descriptors - including those
> opened for logging.
>
> What is the best approach to handle such situation? Should I close all
> FD before daemonizing or just forget it? Any other hints?
>
> Kind regards,
>
I use this, YMMV:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: daemon.py
Type: text/x-python
Size: 2444 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20081107/e2200ec1/attachment-0001.py>
More information about the Python-list
mailing list