how can a daemon output to console

J

Jason Chan

Dear all,

I am using the Proc::Daemon module to make my script run in the
background. When there is a critical error, I want to output a error
message to the user so that he can *see* it. I tried the following but
doesn't work:
print STDERR "FATAL Error message";

Any idea?

TIA,
Michael Fung
 
M

Malcolm Dew-Jones

Jason Chan ([email protected]) wrote:
: Dear all,

: I am using the Proc::Daemon module to make my script run in the
: background. When there is a critical error, I want to output a error
: message to the user so that he can *see* it. I tried the following but
: doesn't work:
: print STDERR "FATAL Error message";

: Any idea?

One option would be Sys::Syslog. I think you'll find that one of the
logging options is to send the message to the console, but sending it to a
log file (see /etc/syslog.conf maybe?) may be even better, since if it's a
daemon then what "user" will actually be examining the console?

If you want to print to STDERR during development, then syslog may have an
option to do that also, though in that case you may not want to truly
daemonize, merely go into the background (perhaps Proc::Daemon has options
to control that sort of thing).
 
M

Michele Dondi

One option would be Sys::Syslog. I think you'll find that one of the
logging options is to send the message to the console, but sending it to a
log file (see /etc/syslog.conf maybe?) may be even better, since if it's a
daemon then what "user" will actually be examining the console?

Personally, as a user of some machines of which I was not the admin,
I've always been annoyed by system error messages appearing on the
console at any time (I remember a particularly annoying one about
/dev/hdb4 iirc, probably from the kernel itself), but OTOH it is also
true that at least with some of these errors, if common users would
have not warned the wise admins about "Hey, what's up here? Did I do
something wrong?!?", then the wise admins probably would have never
known that there was something going wrong...

Who knows?!?


Michele
 
J

Jason Chan

(e-mail address removed) (Malcolm Dew-Jones) wrote in message >
One option would be Sys::Syslog. I think you'll find that one of the
logging options is to send the message to the console, but sending it to a
log file (see /etc/syslog.conf maybe?) may be even better, since if it's a
daemon then what "user" will actually be examining the console?

Thanks for your comment.

Rgds,
Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,146
Messages
2,570,832
Members
47,374
Latest member
anuragag27

Latest Threads

Top