Logging error messages in a Daemon Program



Hi,

I am converting an existing application into a daemon program. I have a
query on error message logging. Since the application creates daily
logs its does not use syslog, instead all message a logged in a log
file.

I am trying to figure out the best way to inform the user of an error,
under conditions where the application is not able to open/create a log
file.

One of the ways I found on the net is to re-direct it to /dev/console.
Are there any other ways of doing it?

Currently I am not closing stderr. Incase log file open fails all error
messages are directed to stderr. While running the daemon I redirect
stderr to a file.

What problems could arise on doing this? (other than losing messages
when stderr is not redirected)

Would help if I could some input on the above.

Thanks and Regards,
M Shetty

.



Relevant Pages

  • Logging error messages in a Daemon program
    ... I am converting an existing application into a daemon program. ... query on error message logging. ... Currently I am not closing stderr. ... While running the daemon I redirect ...
    (comp.os.linux.development.apps)
  • Re: redirect the output to a file
    ... you have two commands executed in sequence. ... That will cause all output from /make/ to stdout to be sent to ... error messages sent to stderr will only go to the screen. ... Will first redirect stderr to stdout, then send it all to /tee/. ...
    (comp.os.linux.misc)
  • Re: [Full-Disclosure] cmd.exe bug in win2k sp4 in "for" loop ... erratum
    ... " When you redirect a program's output, ... specifiy which output you want (STDOUT or stderr)." ... stdin is used for inputs, ...
    (Full-Disclosure)
  • Re: Redirecting STDERR
    ... > I have a script where I redirect STDERR to a file so that I can capture ... > redirect 'die' messages? ...
    (perl.beginners)
  • Redirecting stderr and stdout to syslog
    ... How do I redirect ALL stderr stuff to syslog, even stderr from external programs that don't explicitly change their own stderr? ... What I want is the "ls: cannot access asdfsdf: No such file or directory" message to go to syslog instead: ...
    (comp.lang.python)