RE: create log as well as print on screen
Mark wrote: >>>-Original Message- >>>From: mark sony [mailto:[EMAIL PROTECTED] >>>Sent: mercoledì 20 agosto 2003 15.11 >>>To: [EMAIL PROTECTED] >>>Cc: [EMAIL PROTECTED] >>>Subject: create log as well as print on screen >>>Hi All, >>>I wrote a script which is running perfectly fine providing >>>many outputs on the screen . Only glitch is that it does not print >>>in a log file . Now what I want is that it would print on the >>>screen as well as create a log file . At the end of the program I >>>will output that the above output can also be seen at the >>>$log_File_position . Hope I am clear with my question . Any type >>>of pointers and I would be over the moon ;) >>>Thanx in advance >>>Mark I simply solve your problem in this manner (defining a sub log()...): . . . . . . open (LOG, ">>my_log_file"); . . . &log("some text\n", 1, 1); # log on screen AND log on file . . . &log("some text\n", 1, 0); # log on screen only . . . &log("some text\n", 0, 1); # log on file only . . . close(LOG); . . . . . . sub log() { my ($stg, $a, $b) = @_; print $stg if $a; print LOG $stg if $b; } E. LOQUENDO S.p.A. Vocal Technology and Services www.loquendo.it [EMAIL PROTECTED] CONFIDENTIALITY NOTICE This message and its attachments are addressed solely to the persons above and may contain confidential information. If you have received the message in error, be informed that any use of the content hereof is prohibited. Please return it immediately to the sender and delete the message. Should you have any questions, please contact us by replying to [EMAIL PROTECTED] Thank you -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: create log as well as print on screen
In unix there is a program called tee. It works something like program.pl | tee log.file you just have program.pl write to STDOUT alternatively, in your program, you could just do my $log = "log.file"; open( LOG, ">>log.file" ); print "THING\n"; print LOG "THING\n"; close LOG; ( basically print twice for everything you print. -Original Message- From: mark sony [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 20, 2003 8:11 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: create log as well as print on screen Hi All, I wrote a script which is running perfectly fine providing many outputs on the screen . Only glitch is that it does not print in a log file . Now what I want is that it would print on the screen as well as create a log file . At the end of the program I will output that the above output can also be seen at the $log_File_position . Hope I am clear with my question . Any type of pointers and I would be over the moon ;) Thanx in advance Mark ___ Meet your old school or college friends from 1 Million + database... Click here to reunite www.batchmates.com/rediff.asp -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: create log as well as print on screen
old_script.pl | perl -e "while (<>) {print $_; warn $_}" 2> $logFile Or redefine the print -Original Message- From: mark sony [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 20, 2003 3:11 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: create log as well as print on screen Hi All, I wrote a script which is running perfectly fine providing many outputs on the screen . Only glitch is that it does not print in a log file . Now what I want is that it would print on the screen as well as create a log file . At the end of the program I will output that the above output can also be seen at the $log_File_position . Hope I am clear with my question . Any type of pointers and I would be over the moon ;) Thanx in advance Mark ___ Meet your old school or college friends from 1 Million + database... Click here to reunite www.batchmates.com/rediff.asp -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: create log as well as print on screen
From: "mark sony" <[EMAIL PROTECTED]> > I wrote a script which is running perfectly fine providing > many outputs on the screen . Only glitch is that it does not print in > a log file . Now what I want is that it would print on the screen as > well as create a log file . At the end of the program I will output > that the above output can also be seen at the $log_File_position . > Hope I am clear with my question . Any type of pointers and I would be > over the moon ;) http://search.cpan.org/dist/IO-Tee/ http://jenda.krynicky.cz/#Local::TeeOutput HTH, Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]