Shell script for capturing FTP logs

I have a script

#!/bin/bash
HOST=ftp.example.com
USER=ftpuser
PASSWORD=P@ssw0rd
 
ftp -inv $HOST <<EOF
user $USER $PASSWORD
cd /path/to/file
mput *.html
bye
EOF

the script executes sucessfully I need to capture the FTP logs to a logfile
should contain

FTP Login successful
...

Can you please help with this ?

What have you tried with redirection? I think you might get it working with something like this:-

#!/bin/bash
HOST=ftp.example.com
USER=ftpuser
PASSWORD=P@ssw0rd
logfile=/path/to/logs/filename.$$
 
ftp -inv $HOST <<EOF > $logfile
user $USER $PASSWORD
cd /path/to/file
mput *.html
bye
EOF

Using $$ in the filename appends the PID, so fairly random to avoid overwriting.
You could choose a fixed log file and append to it by using >> $logfile or you could use a date/timestamp like one of these:-

logfile="/path/to/logs/filename.$(date +%Y%m%d_%T)"             # Time stamp is YYYYMoDD_HH:Mi:SS
logfile="/path/to/logs/filename.$(date +%s)"                    # Time is in seconds from the Epoch
logfile="/path/to/logs/filename.$(date +%s.%N)"                 # Time is in nano seconds from the Epoch

Some of the date flags might be OS dependant though.

Do any of these help?
Robin