By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,442 Members | 1,580 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,442 IT Pros & Developers. It's quick & easy.

syslog best practices -- when to call closelog?

P: n/a

I have a question:

When should syslog.closelog() be called? I have a daemon that spends
most of its time asleep and quiet, but writes messages to the mail log
when active. Should I open the log at the start and keep it open until
the program closes? This seems much simpler than issuing three
commands everytime I want to write to the log.

The program will essentially be running constantly. Is having the log
constantly "open" a problem? What happens if the program crashes or is
killed without a closelog()?

Jeff

Jul 10 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
In article <11**********************@b28g2000cwb.googlegroups .com>,
J Rice <ri**********@gmail.comwrote:
>
I have a question:

When should syslog.closelog() be called? I have a daemon that spends
most of its time asleep and quiet, but writes messages to the mail log
when active. Should I open the log at the start and keep it open until
the program closes? This seems much simpler than issuing three
commands everytime I want to write to the log.

The program will essentially be running constantly. Is having the log
constantly "open" a problem? What happens if the program crashes or is
killed without a closelog()?

Jeff
In your terms, it's entirely safe to leave open the handle to syslog.
The operating system takes responsibility for cleanup on shutdown of
your application.
Jul 11 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.