remove static logs

This commit is contained in:
zzz
2012-02-28 15:58:02 +00:00
parent 17f7264863
commit ede1b1954c
5 changed files with 26 additions and 21 deletions

View File

@@ -36,7 +36,7 @@ import net.i2p.util.Log;
* @author jrandom
*/
public class ClientManagerFacadeImpl extends ClientManagerFacade implements InternalClientManager {
private final static Log _log = new Log(ClientManagerFacadeImpl.class);
private final Log _log;
private ClientManager _manager;
private RouterContext _context;
/** note that this is different than the property the client side uses, i2cp.tcp.port */
@@ -48,7 +48,8 @@ public class ClientManagerFacadeImpl extends ClientManagerFacade implements Inte
public ClientManagerFacadeImpl(RouterContext context) {
_context = context;
_log.debug("Client manager facade created");
_log = _context.logManager().getLog(ClientManagerFacadeImpl.class);
//_log.debug("Client manager facade created");
}
public void startup() {

View File

@@ -27,7 +27,7 @@ import net.i2p.util.Log;
* @author moved from Hash.java by zzz
*/
class LocalHash extends Hash {
private final static Log _log = new Log(LocalHash.class);
//private final static Log _log = new Log(LocalHash.class);
private /* FIXME final FIXME */ Map<Hash, byte[]> _xorCache;
private static final int MAX_CACHED_XOR = 1024;
@@ -86,6 +86,7 @@ class LocalHash extends Hash {
_xorCache.put(key, distance);
cached = _xorCache.size();
}
/****
if (_log.shouldLog(Log.DEBUG)) {
// explicit buffer, since the compiler can't guess how long it'll be
StringBuilder buf = new StringBuilder(128);
@@ -94,7 +95,9 @@ class LocalHash extends Hash {
buf.append(DataHelper.toHexString(key.getData()));
_log.debug(buf.toString(), new Exception());
}
****/
} else {
/****
if (_log.shouldLog(Log.DEBUG)) {
// explicit buffer, since the compiler can't guess how long it'll be
StringBuilder buf = new StringBuilder(128);
@@ -103,6 +106,7 @@ class LocalHash extends Hash {
buf.append(DataHelper.toHexString(key.getData()));
_log.debug(buf.toString());
}
****/
}
return distance;
}

View File

@@ -27,7 +27,7 @@ import net.i2p.util.Log;
*/
class MessageWrapper {
private static final Log _log = RouterContext.getGlobalContext().logManager().getLog(MessageWrapper.class);
//private static final Log _log = RouterContext.getGlobalContext().logManager().getLog(MessageWrapper.class);
private static final int NETDB_TAGS_TO_DELIVER = 6;
private static final int NETDB_LOW_THRESHOLD = 3;
@@ -71,8 +71,8 @@ class MessageWrapper {
PublicKey sentTo = to.getIdentity().getPublicKey();
if (!sentTags.isEmpty())
tsh = skm.tagsDelivered(sentTo, sentKey, sentTags);
if (_log.shouldLog(Log.DEBUG))
_log.debug("Sent to: " + to.getIdentity().getHash() + " with key: " + sentKey + " and tags: " + sentTags.size());
//if (_log.shouldLog(Log.DEBUG))
// _log.debug("Sent to: " + to.getIdentity().getHash() + " with key: " + sentKey + " and tags: " + sentTags.size());
return new WrappedMessage(msg, skm, sentTo, sentKey, tsh);
}
@@ -103,8 +103,8 @@ class MessageWrapper {
void acked() {
if (this.tsh != null) {
this.skm.tagsAcked(this.sentTo, this.sessionKey, this.tsh);
if (_log.shouldLog(Log.DEBUG))
_log.debug("Tags acked for key: " + this.sessionKey);
//if (_log.shouldLog(Log.DEBUG))
// _log.debug("Tags acked for key: " + this.sessionKey);
}
}
@@ -112,8 +112,8 @@ class MessageWrapper {
void fail() {
if (this.tsh != null) {
this.skm.failTags(this.sentTo, this.sessionKey, this.tsh);
if (_log.shouldLog(Log.DEBUG))
_log.debug("Tags NOT acked for key: " + this.sessionKey);
//if (_log.shouldLog(Log.DEBUG))
// _log.debug("Tags NOT acked for key: " + this.sessionKey);
}
}
}

View File

@@ -11,6 +11,7 @@ package net.i2p.router.transport.ntcp;
import java.net.InetAddress;
import java.util.Properties;
import net.i2p.I2PAppContext;
import net.i2p.data.DataHelper;
import net.i2p.data.RouterAddress;
import net.i2p.router.transport.TransportImpl;
@@ -20,7 +21,6 @@ import net.i2p.util.Log;
* Wrap up an address
*/
public class NTCPAddress {
private final static Log _log = new Log(NTCPAddress.class);
private int _port;
private String _host;
//private InetAddress _addr;
@@ -68,7 +68,8 @@ public class NTCPAddress {
try {
_port = Integer.parseInt(port.trim());
} catch (NumberFormatException nfe) {
_log.error("Invalid port [" + port + "]", nfe);
Log log = I2PAppContext.getGlobalContext().logManager().getLog(NTCPAddress.class);
log.error("Invalid port [" + port + "]", nfe);
_port = -1;
}
} else {
@@ -119,8 +120,8 @@ public class NTCPAddress {
//}
return TransportImpl.isPubliclyRoutable(quad);
} catch (Throwable t) {
if (_log.shouldLog(Log.WARN))
_log.warn("Error checking routability", t);
//if (_log.shouldLog(Log.WARN))
// _log.warn("Error checking routability", t);
return false;
}
}

View File

@@ -18,7 +18,6 @@ import net.i2p.util.Log;
*/
class UDPPacket {
private I2PAppContext _context;
private static Log _log;
private final DatagramPacket _packet;
private volatile short _priority;
private volatile long _initializeTime;
@@ -48,7 +47,6 @@ class UDPPacket {
_packetCache = new LinkedBlockingQueue(CACHE_SIZE);
else
_packetCache = null;
_log = I2PAppContext.getGlobalContext().logManager().getLog(UDPPacket.class);
}
/**
@@ -214,8 +212,8 @@ class UDPPacket {
eq = DataHelper.eq(hmac.getData(), 0, _data, _packet.getOffset(), MAC_SIZE);
*/
} else {
if (_log.shouldLog(Log.WARN))
_log.warn("Payload length is " + payloadLength);
//if (_log.shouldLog(Log.WARN))
// _log.warn("Payload length is " + payloadLength);
}
_afterValidate = _context.clock().now();
@@ -321,9 +319,10 @@ class UDPPacket {
private void verifyNotReleased() {
if (CACHE) return;
if (_released) {
_log.log(Log.CRIT, "Already released. current stack trace is:", new Exception());
_log.log(Log.CRIT, "Released by: ", _releasedBy);
_log.log(Log.CRIT, "Acquired by: ", _acquiredBy);
Log log = I2PAppContext.getGlobalContext().logManager().getLog(UDPPacket.class);
log.log(Log.CRIT, "Already released. current stack trace is:", new Exception());
log.log(Log.CRIT, "Released by: ", _releasedBy);
log.log(Log.CRIT, "Acquired by: ", _acquiredBy);
}
}
}