Merge pull request #65 from ryantenney/logging-fix

Avoid string concatenation in log statements
This commit is contained in:
Shikhar Bhushan
2012-03-20 01:10:52 -07:00
4 changed files with 8 additions and 8 deletions

View File

@@ -107,7 +107,7 @@ public class StreamCopier {
log.debug("Done copying from {}", in); log.debug("Done copying from {}", in);
doneEvent.set(); doneEvent.set();
} catch (IOException ioe) { } catch (IOException ioe) {
log.error("In pipe from {} to {}: " + ioe.toString(), in, out); log.error("In pipe from {} to {}: {}", new Object[] { in, out, ioe });
doneEvent.deliverError(ioe); doneEvent.deliverError(ioe);
} }
} }
@@ -136,7 +136,7 @@ public class StreamCopier {
final double timeSeconds = (System.currentTimeMillis() - startTime) / 1000.0; final double timeSeconds = (System.currentTimeMillis() - startTime) / 1000.0;
final double sizeKiB = count / 1024.0; final double sizeKiB = count / 1024.0;
log.info(sizeKiB + " KiB transferred in {} seconds ({} KiB/s)", timeSeconds, (sizeKiB / timeSeconds)); log.info("{} KiB transferred in {} seconds ({} KiB/s)", new Object[] { sizeKiB, timeSeconds, (sizeKiB / timeSeconds) });
if (length != -1 && read == -1) if (length != -1 && read == -1)
throw new IOException("Encountered EOF, could not transfer " + length + " bytes"); throw new IOException("Encountered EOF, could not transfer " + length + " bytes");

View File

@@ -57,7 +57,7 @@ public abstract class Window {
throws ConnectionException { throws ConnectionException {
synchronized (lock) { synchronized (lock) {
size -= dec; size -= dec;
log.debug("Consuming by " + dec + " down to " + size); log.debug("Consuming by {} down to {}", dec, size);
if (size < 0) if (size < 0)
throw new ConnectionException("Window consumed to below 0"); throw new ConnectionException("Window consumed to below 0");
} }

View File

@@ -44,7 +44,7 @@ public class SocketForwardingConnectListener
@Override @Override
public void gotConnect(Channel.Forwarded chan) public void gotConnect(Channel.Forwarded chan)
throws IOException { throws IOException {
log.info("New connection from " + chan.getOriginatorIP() + ":" + chan.getOriginatorPort()); log.info("New connection from {}:{}", chan.getOriginatorIP(), chan.getOriginatorPort());
final Socket sock = new Socket(); final Socket sock = new Socket();
sock.setSendBufferSize(chan.getLocalMaxPacketSize()); sock.setSendBufferSize(chan.getLocalMaxPacketSize());

View File

@@ -31,7 +31,7 @@ public class StatefulSFTPClient
throws IOException { throws IOException {
super(engine); super(engine);
this.cwd = getSFTPEngine().canonicalize("."); this.cwd = getSFTPEngine().canonicalize(".");
log.info("Start dir = " + cwd); log.info("Start dir = {}", cwd);
} }
private synchronized String cwdify(String path) { private synchronized String cwdify(String path) {
@@ -44,7 +44,7 @@ public class StatefulSFTPClient
if (statExistence(cwd) == null) { if (statExistence(cwd) == null) {
throw new SFTPException(cwd + ": does not exist"); throw new SFTPException(cwd + ": does not exist");
} }
log.info("CWD = " + cwd); log.info("CWD = {}", cwd);
} }
public synchronized List<RemoteResourceInfo> ls() public synchronized List<RemoteResourceInfo> ls()