syslog best practices -- when to call closelog?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • J Rice

    #1

    syslog best practices -- when to call closelog?


    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

  • Cameron Laird

    #2
    Re: syslog best practices -- when to call closelog?

    In article <1152568999.765 845.150940@b28g 2000cwb.googleg roups.com>,
    J Rice <rice.jeffrey@g mail.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.

    Comment

    Working...