Unix Programming - Logging error messages in a Daemon Program

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > December 2005 > Logging error messages in a Daemon Program





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Logging error messages in a Daemon Program
mshetty@mail.com

2005-12-29, 6:05 pm

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

Rich Teer

2005-12-29, 6:05 pm

On Thu, 29 Dec 2005, mshetty@mail.com wrote:

> 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.


OK.

> 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.


Using syslog is the usual approach.

So, use your usual log file for regular stuff, and/or syslog for error
messages.

--
Rich Teer, SCNA, SCSA, OpenSolaris CAB member

. * * . * .* .
. * . .*
President, * . . /\ ( . . *
Rite Online Inc. . . / .\ . * .
.*. / * \ . .
. /* o \ .
Voice: +1 (250) 979-1638 * '''||''' .
URL: http://www.rite-group.com/rich ******************
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com