S
Snail
Hello. I am trying to write a logging program to wrap around a server
program that we need that doesn't have logging capabilities of it's own.
Normally, one would just redirect it on the command line:
../server 2>&1 logfile.log
But this doesn't have any dating what so ever and it can get hard to
read as it grows.
My goal is to start the program from my program and get both it's
STDOUT/ERR and STDIN, that way my program can see live Output as it
comes in from the server and also respond to certain events (the server
accepts console commands when it is normally run in the foreground, so
it can be fully interactive, accepting command via STDIN normally.
I've been search all over (perldoc, google, etc) and all I could find
was examples of getting STDIN or STDOUT (using pipes) but not both at
the same time. Further mode, I need this to be in real time (when the
server spits out something to STDOUT/ERR I want my program to
immediately get this, and then process it (add a line to the log file,
perform some processing if a certain event occurs, such has a new
connection, etc.)
Thank for any help.
program that we need that doesn't have logging capabilities of it's own.
Normally, one would just redirect it on the command line:
../server 2>&1 logfile.log
But this doesn't have any dating what so ever and it can get hard to
read as it grows.
My goal is to start the program from my program and get both it's
STDOUT/ERR and STDIN, that way my program can see live Output as it
comes in from the server and also respond to certain events (the server
accepts console commands when it is normally run in the foreground, so
it can be fully interactive, accepting command via STDIN normally.
I've been search all over (perldoc, google, etc) and all I could find
was examples of getting STDIN or STDOUT (using pipes) but not both at
the same time. Further mode, I need this to be in real time (when the
server spits out something to STDOUT/ERR I want my program to
immediately get this, and then process it (add a line to the log file,
perform some processing if a certain event occurs, such has a new
connection, etc.)
Thank for any help.