title: How can I log lftp errors in bash script
body: <p>I'm writing a bash script to download/upload files using lftp with logging  enable to file (<code>set xfer:log-file "$LOGFILE"</code>). </p>
  
  <p>During my tests I had an <code>550 access denied error</code> but to my surprise the error went to stdout instead of going into my logfile and I found no way of capturing the error. I'm pasting my upload function below.</p>
  
  <pre><code>function xfer_up(){
    FOUND=$(ls $OUTBOX | wc -l)
    if [ $FOUND &lt;= 0]; then
      log_info "no files available at $2 (EMPTY FOLDER)."
      return
    fi
    log_info "transfering files from $FOUND into $1/$2"
    lftp -u ${USER},${PASSWD} $1 &lt;&lt; LFTP
  set xfer:log true
  set xfer:log-file "$LOGFILE"
  set xfer:clobber true
  set xfer:auto-rename true
  debug 3
  mput $OUTBOX/*.txt -O $2
  quit
  LFTP
  }
  </code></pre>
  
  <p>Any ideas about how can I log this errors?</p>