srini_veera has asked for the wisdom of the Perl Monks concerning the following question:

Hi Paul and derby, I am using the Debug option which is giving all the details like the following on the STDOUT. ==================================================== Net::FTP=GLOB(0x4002fa90)>>> PORT 10,201,15,62,216,20 Net::FTP=GLOB(0x4002fa90)<<< 200 PORT command successful. Net::FTP=GLOB(0x4002fa90)>>> STOR 1 Net::FTP=GLOB(0x4002fa90)<<< 150 Opening ASCII mode data connection for 1. Net::FTP=GLOB(0x4002fa90)<<< 226 Transfer complete. files that are ftpd arefilename is ::2 Net::FTP=GLOB(0x4002fa90)>>> PORT 10,201,15,62,216,21 Net::FTP=GLOB(0x4002fa90)<<< 200 PORT command successful. Net::FTP=GLOB(0x4002fa90)>>> STOR 2 Net::FTP=GLOB(0x4002fa90)<<< 150 Opening ASCII mode data connection for 2. Net::FTP=GLOB(0x4002fa90)<<< 226 Transfer complete. files that are ftpd arefilename is ::a Net::FTP=GLOB(0x4002fa90)>>> PORT 10,201,15,62,216,22 Net::FTP=GLOB(0x4002fa90)<<< 200 PORT command successful. Net::FTP=GLOB(0x4002fa90)>>> STOR a Net::FTP=GLOB(0x4002fa90)<<< 150 Opening ASCII mode data connection for a. Net::FTP=GLOB(0x4002fa90)<<< 226 Transfer complete. files that are ftpd arefilename is ::b ===================================================== But how do i put all these details into a logfile ? Please help thanks in advance Veera

Replies are listed 'Best First'.
Re: perl ftp
by aukjan (Friar) on May 20, 2005 at 13:31 UTC
    Please use <code> tags...

    And if you run it on the command line try adding 2>>file.log

    .:| If it can't be fixed .. Don't break it |:.
Re: perl ftp
by tphyahoo (Vicar) on May 20, 2005 at 13:48 UTC
    perl -e "some code which is an error" 2> output.txt

    perl -e "some code which is not an error" > output.txt

    good luck.

      Save output and errors separately
      perl script.pl >output.txt 2>errors.txt
      Save all output in a single file
      perl script.pl >output.txt 2>&1
      You can also use the UNIX tee command to view output and save it to a file. A windows version is available from http://unxutils.sourceforge.net
      perl script.pl 2>&1 | tee stdout.txt
      Hi friends, please have a look at the data that i put in the mail.it contains details of the output that is sent to the STDOUT and there is no error in the script no in the output. All i want is to send the same output to some logfile. but when i tried to redirect nothing went in. I got this out put after i set the Debug option as 1 in the ftp connection. Please advice.i need the whole output to be logged. Thanks Veera
        Try the variations in my post above. Your script will use both STDOUT and STDERR. Both of these normally send output to the console where it all appears the same. The Net::FTP debug code is sent to STDERR rather than STDOUT.

        The simple redirection perl script.pl >file will send only STDOUT to the file.

        perl script.pl 2>file will send the STDERR to the file. The 2> selects STDERR as the file handle.

        This command redirects both STDOUT and STDERR to a file. perl script.pl >file 2>&1