log.info("Took: " + TimeUtils.printDuration(time) + " (" + time + " millis)");
@Override public void onDownloadComplete(String host, String file) { String prefix = resume ? "Resume downloading" : "Downloading"; String msg = prefix + " from host: " + host + " file: " + file + " completed"; if (transferredBytes > 0) { msg += " (size: " + StringHelper.humanReadableBytes(transferredBytes) + ")"; } long taken = watch.taken(); String time = TimeUtils.printDuration(taken); msg += " (took: " + time + ")"; doLog(msg); }
@Override public void onUploadComplete(String host, String file) { String msg = "Uploading to host: " + host + " file: " + file + " completed"; if (transferredBytes > 0) { msg += " (size: " + StringHelper.humanReadableBytes(transferredBytes) + ")"; } long taken = watch.taken(); String time = TimeUtils.printDuration(taken); msg += " (took: " + time + ")"; doLog(msg); }
@ManagedAttribute(description = "Summary of last FTP activity (download only)") public String getLastFtpActivity() { FTPClient client = getOperations().getFtpClient(); FtpClientActivityListener listener = (FtpClientActivityListener) client.getCopyStreamListener(); if (listener != null) { String log = listener.getLastLogActivity(); if (log != null) { long since = listener.getLastLogActivityTimestamp(); if (since > 0) { StopWatch watch = new StopWatch(new Date(since)); long delta = watch.taken(); String human = TimeUtils.printDuration(delta); return log + " " + human + " ago"; } else { return log; } } } return null; }
@ManagedAttribute(description = "Summary of last FTP activity (all)") public String getLastFtpActivityVerbose() { FTPClient client = getOperations().getFtpClient(); FtpClientActivityListener listener = (FtpClientActivityListener) client.getCopyStreamListener(); if (listener != null) { String log = listener.getLastVerboseLogActivity(); if (log != null) { long since = listener.getLastVerboseLogActivityTimestamp(); if (since > 0) { StopWatch watch = new StopWatch(new Date(since)); long delta = watch.taken(); String human = TimeUtils.printDuration(delta); return log + " " + human + " ago"; } else { return log; } } } return null; }
long time = watch.taken(); log.debug("Took {} ({} millis) to store file: {} and FTP client returned: {}", new Object[]{TimeUtils.printDuration(time), time, targetName, answer});
LOG.debug("Took {} ({} millis) to store file: {} and FTP client returned: true", new Object[] {TimeUtils.printDuration(time), time, targetName});