Cynthia,
Well, not exactly. What I have done is to make a daemon out of
our Java application. I don't have much experience with threading
under Linux, but someone mentioned on this list that signal handling
can be tricky since the thread that receives the signal may not be
the thread listening for it (I'm quoting from memory here, but I don't
think I'm too far off base). A daemon, of course, should respond
to signals, so I created a parent process in C to handle it with a
child launching a Java VM via the Invocation API.
To make a long story short (sorry for the winding answer), I created
two pipes before forking and exec'ing the child. The first pipe is
tied (with dup2) to both STDOUT and STDERR of the child process
and the second pipe is tied to STDIN. All output from the Java
application is routed to syslog. When the parent receives a signal
to shutdown, it closes the second pipe. The main thread of the
Java application is blocked reading System.in. When it detects
the close, it simply cleans up and shuts down the application.
For a simpler application, I'm sure you could implement a logging
method to syslog via JNI without going through the trouble explained
above. :-)
Good luck,
Russ
[EMAIL PROTECTED] on 04/05/99 11:40:24 AM
To: [EMAIL PROTECTED]
cc: (bcc: Russell Pridemore/Lex/Lexmark)
Subject: Using Syslog from Java
Has anyone implemented the equivalent of the syslog commands --
openlog, syslog and closelog-- in Java. If so, any pointers in terms of
the protocol.
Thanks,
Cynthia Jeness
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]