Varargified log calls.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5697 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2009-03-26 00:02:19 +00:00
parent 647a25dfdc
commit 688f2580ed
46 changed files with 231 additions and 272 deletions
@@ -56,7 +56,7 @@ public abstract class Authenticator
try {
processAuthentication(conn, rsp);
} catch (Exception e) {
log.warning("Error authenticating user [areq=" + req + "].", e);
log.warning("Error authenticating user", "areq", req, e);
rdata.code = AuthCodes.SERVER_ERROR;
}
return true;
@@ -129,7 +129,7 @@ public class ClientManager
// from interface ShutdownManager.Shutdowner
public void shutdown ()
{
log.info("Client manager shutting down [ccount=" + _usermap.size() + "].");
log.info("Client manager shutting down", "ccount", _usermap.size());
_flushClients.cancel();
@@ -139,8 +139,8 @@ public class ClientManager
try {
pc.shutdown();
} catch (Exception e) {
log.warning("Client choked in shutdown() [client=" +
StringUtil.safeToString(pc) + "].", e);
log.warning("Client choked in shutdown()",
"client", StringUtil.safeToString(pc), e);
}
}
}
@@ -429,8 +429,7 @@ public class ClientManager
// remove the client from the connection map
PresentsSession client = _conmap.remove(conn);
if (client != null) {
log.info("Unmapped failed client [client=" + client + ", conn=" + conn +
", fault=" + fault + "].");
log.info("Unmapped failed client", "client", client, "conn", conn, "fault", fault);
// let the client know the connection went away
client.wasUnmapped();
// and let the client know things went haywire
@@ -449,7 +448,7 @@ public class ClientManager
// remove the client from the connection map
PresentsSession client = _conmap.remove(conn);
if (client != null) {
log.debug("Unmapped client [client=" + client + ", conn=" + conn + "].");
log.debug("Unmapped client", "client", client, "conn", conn);
// let the client know the connection went away
client.wasUnmapped();
@@ -545,11 +544,11 @@ public class ClientManager
// now end their sessions
for (PresentsSession client : victims) {
try {
log.info("Client expired, ending session [session=" + client +
", dtime=" + (now-client.getNetworkStamp()) + "ms].");
log.info("Client expired, ending session", "session", client,
"dtime", (now-client.getNetworkStamp()) + "ms].");
client.endSession();
} catch (Exception e) {
log.warning("Choke while flushing client [victim=" + client + "].", e);
log.warning("Choke while flushing client", "victim", client, e);
}
}
}
@@ -567,8 +566,7 @@ public class ClientManager
_clop.apply(clobj);
} catch (Exception e) {
log.warning("Client op failed [username=" + username +
", clop=" + _clop + "].", e);
log.warning("Client op failed", "username", username, "clop", _clop, e);
} finally {
releaseClientObject(username);
@@ -192,8 +192,8 @@ public class ClientResolver extends Invoker.Unit
try {
crl.resolutionFailed(_username, cause);
} catch (Exception e) {
log.warning("Client resolution listener choked in resolutionFailed() [crl=" + crl +
", username=" + _username + ", cause=" + cause + "].", e);
log.warning("Client resolution listener choked in resolutionFailed()", "crl", crl,
"username", _username, "cause", cause, e);
}
}
}
@@ -48,10 +48,7 @@ public abstract class InvocationDispatcher<T extends InvocationMarshaller>
public void dispatchRequest (ClientObject source, int methodId, Object[] args)
throws InvocationException
{
log.warning("Requested to dispatch unknown method " +
"[provider=" + provider +
", sourceOid=" + source.getOid() +
", methodId=" + methodId +
", args=" + StringUtil.toString(args) + "].");
log.warning("Requested to dispatch unknown method", "provider", provider,
"sourceOid", source.getOid(), "methodId", methodId, "args", args);
}
}
@@ -83,7 +83,7 @@ public class InvocationManager
invobj.addListener(this);
_invoid = invobj.getOid();
// log.info("Created invocation service object [oid=" + _invoid + "].");
// log.info("Created invocation service object", "oid", _invoid);
}
/**
@@ -151,7 +151,7 @@ public class InvocationManager
_recentRegServices.put(Integer.valueOf(invCode), marsh.getClass().getName());
// log.info("Registered service [marsh=" + marsh + "].");
// log.info("Registered service", "marsh", marsh);
return marsh;
}
@@ -169,8 +169,8 @@ public class InvocationManager
}
if (_dispatchers.remove(marsh.getInvocationCode()) == null) {
log.warning("Requested to remove unregistered marshaller? " +
"[marsh=" + marsh + "].", new Exception());
log.warning("Requested to remove unregistered marshaller?", "marsh", marsh,
new Exception());
}
}
@@ -224,21 +224,17 @@ public class InvocationManager
// make sure the client is still around
ClientObject source = (ClientObject)_omgr.getObject(clientOid);
if (source == null) {
log.info("Client no longer around for invocation " +
"request [clientOid=" + clientOid +
", code=" + invCode + ", methId=" + methodId +
", args=" + StringUtil.toString(args) + "].");
log.info("Client no longer around for invocation request", "clientOid", clientOid,
"code", invCode, "methId", methodId, "args", args);
return;
}
// look up the dispatcher
InvocationDispatcher<?> disp = _dispatchers.get(invCode);
if (disp == null) {
log.info("Received invocation request but dispatcher " +
"registration was already cleared [code=" + invCode +
", methId=" + methodId +
", args=" + StringUtil.toString(args) + ", marsh=" +
_recentRegServices.get(Integer.valueOf(invCode)) + "].");
log.info("Received invocation request but dispatcher registration was already cleared",
"code", invCode, "methId", methodId, "args", args,
"marsh", _recentRegServices.get(Integer.valueOf(invCode)));
return;
}
@@ -259,9 +255,8 @@ public class InvocationManager
}
}
// log.debug("Dispatching invreq [caller=" + source.who() +
// ", disp=" + disp + ", methId=" + methodId +
// ", args=" + StringUtil.toString(args) + "].");
// log.debug("Dispatching invreq", "caller", source.who(), "disp", disp,
// "methId", methodId, "args", args);
// dispatch the request
try {
@@ -276,18 +271,14 @@ public class InvocationManager
rlist.requestFailed(ie.getMessage());
} else {
log.warning("Service request failed but we've got no " +
"listener to inform of the failure " +
"[caller=" + source.who() + ", code=" + invCode +
", dispatcher=" + disp + ", methodId=" + methodId +
", args=" + StringUtil.toString(args) +
", error=" + ie + "].");
log.warning("Service request failed but we've got no listener to inform of " +
"the failure", "caller", source.who(), "code", invCode,
"dispatcher", disp, "methodId", methodId, "args", args, "error", ie);
}
} catch (Throwable t) {
log.warning("Dispatcher choked [disp=" + disp +
", caller=" + source.who() + ", methId=" + methodId +
", args=" + StringUtil.toString(args) + "].", t);
log.warning("Dispatcher choked", "disp", disp, "caller", source.who(),
"methId", methodId, "args", args, t);
// avoid logging an error when the listener notices that it's been ignored.
if (rlist != null) {
@@ -321,7 +312,8 @@ public class InvocationManager
/** Tracks recently registered services so that we can complain informatively if a request
* comes in on a service we don't know about. */
protected final Map<Integer, String> _recentRegServices = new LRUHashMap<Integer, String>(10000);
protected final Map<Integer, String> _recentRegServices =
new LRUHashMap<Integer, String>(10000);
/** The text appended to the procedure name when generating a failure response. */
protected static final String FAILED_SUFFIX = "Failed";
@@ -45,7 +45,7 @@ public class NativeSignalHandler extends AbstractSignalHandler
hupReceived();
break;
default:
log.warning("Received unknown signal [signo=" + signo + "].");
log.warning("Received unknown signal", "signo", signo);
break;
}
return true;
@@ -156,8 +156,8 @@ public class PresentsDObjectMgr
// originating manager after converting them back to the original oid
_proxies.put(object.getOid(), new ProxyReference(origObjectId, omgr));
// TEMP: report what we're doing as we're seeing funny business
log.info("Registered proxy object [type=" + object.getClass().getName() +
", remoid=" + origObjectId + ", locoid=" + object.getOid() + "].");
log.info("Registered proxy object", "type", object.getClass().getName(),
"remoid", origObjectId, "locoid", object.getOid());
}
/**
@@ -168,12 +168,12 @@ public class PresentsDObjectMgr
public void clearProxyObject (int origObjectId, DObject object)
{
if (_proxies.remove(object.getOid()) == null) {
log.warning("Missing proxy mapping for cleared proxy [ooid=" + origObjectId + "].");
log.warning("Missing proxy mapping for cleared proxy", "ooid", origObjectId);
}
_objects.remove(object.getOid());
// TEMP: report what we're doing as we're seeing funny business
log.info("Clearing proxy object [type=" + object.getClass().getName() +
", remoid=" + origObjectId + ", locoid=" + object.getOid() + "].");
log.info("Clearing proxy object", "type", object.getClass().getName(),
"remoid", origObjectId, "locoid", object.getOid());
}
// from interface DObjectManager
@@ -201,8 +201,8 @@ public class PresentsDObjectMgr
public void postEvent (DEvent event)
{
if (!_running) {
log.warning(
"Posting message to inactive object manager", "event", event, new Exception());
log.warning("Posting message to inactive object manager", "event", event,
new Exception());
}
// assign the event's id and append it to the queue
@@ -237,7 +237,7 @@ public class PresentsDObjectMgr
// insert it into the table
_objects.put(oid, object);
// log.info("Registered object [obj=" + object + "].");
// log.info("Registered object", "obj", object);
return object;
}
@@ -278,8 +278,8 @@ public class PresentsDObjectMgr
public void postRunnable (Runnable unit)
{
if (!_running) {
log.warning(
"Posting runnable to inactive object manager", "unit", unit, new Exception());
log.warning("Posting runnable to inactive object manager", "unit", unit,
new Exception());
}
// just append it to the queue
@@ -379,7 +379,7 @@ public class PresentsDObjectMgr
{
int oid = target.getOid();
// log.info("Removing destroyed object from table [oid=" + oid + "].");
// log.info("Removing destroyed object from table", "oid", oid);
// remove the object from the table
_objects.remove(oid);
@@ -433,8 +433,8 @@ public class PresentsDObjectMgr
}
} catch (Exception e) {
log.warning("Unable to clean up after oid list field [target=" + target +
", field=" + field + "].");
log.warning("Unable to clean up after oid list field", "target", target,
"field", field);
}
}
@@ -454,8 +454,8 @@ public class PresentsDObjectMgr
// ensure that the target object exists
if (!_objects.containsKey(oid)) {
log.info("Rejecting object added event of non-existent object " +
"[refferOid=" + target.getOid() + ", reffedOid=" + oid + "].");
log.info("Rejecting object added event of non-existent object",
"refferOid", target.getOid(), "reffedOid", oid);
return false;
}
@@ -508,7 +508,7 @@ public class PresentsDObjectMgr
int toid = target.getOid();
int oid = ore.getOid();
// log.info("Processing object removed [from=" + toid + ", roid=" + toid + "].");
// log.info("Processing object removed", "from", toid, "roid", toid);
// get the reference vector for the referenced object
Reference[] refs = _refs.get(oid);
@@ -517,8 +517,8 @@ public class PresentsDObjectMgr
// reference system and then generate object removed events for all of its referencees.
// so we opt not to log anything in this case
// log.info("Object removed without reference to track it [toid=" + toid +
// ", field=" + field + ", oid=" + oid + "].");
// log.info("Object removed without reference to track it", "toid", toid,
// "field", field, "oid", oid);
return true;
}
@@ -532,8 +532,8 @@ public class PresentsDObjectMgr
}
}
log.warning("Unable to locate reference for removal [reffingOid=" + toid +
", field=" + field + ", reffedOid=" + oid + "].");
log.warning("Unable to locate reference for removal", "reffingOid", toid, "field", field,
"reffedOid", oid);
return true;
}
@@ -669,7 +669,7 @@ public class PresentsDObjectMgr
// look up the target object
DObject target = _objects.get(event.getTargetOid());
if (target == null) {
log.debug("Compound event target no longer exists [event=" + event + "].");
log.debug("Compound event target no longer exists", "event", event);
return;
}
@@ -677,8 +677,7 @@ public class PresentsDObjectMgr
for (int ii = 0; ii < ecount; ii++) {
DEvent sevent = events.get(ii);
if (!target.checkPermissions(sevent)) {
log.warning("Event failed permissions check [event=" + sevent +
", target=" + target + "].");
log.warning("Event failed permissions check", "event", sevent, "target", target);
return;
}
}
@@ -700,14 +699,13 @@ public class PresentsDObjectMgr
// look up the target object
DObject target = _objects.get(event.getTargetOid());
if (target == null) {
log.debug("Event target no longer exists [event=" + event + "].");
log.debug("Event target no longer exists", "event", event);
return;
}
// check the event's permissions
if (!target.checkPermissions(event)) {
log.warning("Event failed permissions check [event=" + event +
", target=" + target + "].");
log.warning("Event failed permissions check", "event", event, "target", target);
return;
}
@@ -751,8 +749,7 @@ public class PresentsDObjectMgr
handleFatalError(event, e);
} catch (Throwable t) {
log.warning("Failure processing event [event=" + event +
", target=" + target + "].", t);
log.warning("Failure processing event", "event", event, "target", target, t);
}
// track the number of events dispatched
@@ -799,9 +796,8 @@ public class PresentsDObjectMgr
// to the referred object which no longer exists; so we don't complain about non- existent
// references if the referree is already destroyed
if (ref == null && _objects.containsKey(reffedOid)) {
log.warning("Requested to clear out non-existent reference " +
"[refferOid=" + reffer.getOid() + ", field=" + field +
", reffedOid=" + reffedOid + "].");
log.warning("Requested to clear out non-existent reference",
"refferOid", reffer.getOid(), "field", field, "reffedOid", reffedOid);
// } else {
// log.info("Cleared out reference " + ref + ".");
@@ -837,7 +833,7 @@ public class PresentsDObjectMgr
_helpers.put(ObjectRemovedEvent.class, method);
} catch (Exception e) {
log.warning("Unable to register event helpers [error=" + e + "].");
log.warning("Unable to register event helpers", "error", e);
}
}
@@ -850,8 +846,8 @@ public class PresentsDObjectMgr
try {
sub.objectAvailable(obj);
} catch (Exception e) {
log.warning("Subscriber choked during object available " +
"[obj=" + StringUtil.safeToString(obj) + ", sub=" + sub + "].", e);
log.warning("Subscriber choked during object available",
"obj", StringUtil.safeToString(obj), "sub", sub, e);
}
}
@@ -90,7 +90,7 @@ public class PresentsServer
String testmod = System.getProperty("test_module");
if (testmod != null) {
try {
log.info("Invoking test module [mod=" + testmod + "].");
log.info("Invoking test module", "mod", testmod);
Class<?> tmclass = Class.forName(testmod);
Runnable trun = (Runnable)tmclass.newInstance();
trun.run();
@@ -125,15 +125,15 @@ public class PresentsServer
{
// output general system information
SystemInfo si = new SystemInfo();
log.info("Starting up server [os=" + si.osToString() + ", jvm=" + si.jvmToString() +
", mem=" + si.memoryToString() + "].");
log.info("Starting up server", "os", si.osToString(), "jvm", si.jvmToString(),
"mem", si.memoryToString());
// register SIGTERM, SIGINT (ctrl-c) and a SIGHUP handlers
boolean registered = false;
try {
registered = injector.getInstance(SunSignalHandler.class).init();
} catch (Throwable t) {
log.warning("Unable to register Sun signal handlers [error=" + t + "].");
log.warning("Unable to register Sun signal handlers", "error", t);
}
if (!registered) {
injector.getInstance(NativeSignalHandler.class).init();
@@ -413,8 +413,8 @@ public class PresentsSession
// first time through we end our session, subsequently _throttle is null and we just drop
// any messages that come in until we've fully shutdown
if (_throttle == null) {
// log.info("Dropping message from force-quit client [conn=" + getConnection() +
// ", msg=" + message + "].");
// log.info("Dropping message from force-quit client", "conn", getConnection(),
// "msg", message);
return;
} else if (_throttle.throttleOp(message.received)) {
@@ -855,8 +855,8 @@ public class PresentsSession
// make darned sure we don't have any remaining subscriptions
if (_subscrips.size() > 0) {
// log.warning("Clearing stale subscriptions [client=" + this +
// ", subscrips=" + _subscrips.size() + "].");
// log.warning("Clearing stale subscriptions", "client", this,
// "subscrips", _subscrips.size());
clearSubscrips(_messagesDropped > 10);
}
return false;
@@ -1004,7 +1004,7 @@ public class PresentsSession
public void dispatch (PresentsSession client, Message msg)
{
SubscribeRequest req = (SubscribeRequest)msg;
// log.info("Subscribing [client=" + client + ", oid=" + req.getOid() + "].");
// log.info("Subscribing", "client", client, "oid", req.getOid());
// forward the subscribe request to the omgr for processing
client._omgr.subscribeToObject(req.getOid(), client.createProxySubscriber());
@@ -1020,7 +1020,7 @@ public class PresentsSession
{
UnsubscribeRequest req = (UnsubscribeRequest)msg;
int oid = req.getOid();
// log.info("Unsubscribing " + client + " [oid=" + oid + "].");
// log.info("Unsubscribing " + client + "", "oid", oid);
// unsubscribe from the object and clear out our proxy
client.unmapSubscrip(oid);
@@ -1051,7 +1051,7 @@ public class PresentsSession
// fill in the proper source oid
fevt.setSourceOid(clobj.getOid());
// log.info("Forwarding event [client=" + client + ", event=" + fevt + "].");
// log.info("Forwarding event", "client", client, "event", fevt);
// forward the event to the omgr for processing
client._omgr.postEvent(fevt);
@@ -298,8 +298,7 @@ public abstract class RebootManager
return false;
}
log.info("Reboot delayed due to outstanding locks: " +
StringUtil.toString(_rebootLocks.elements()));
log.info("Reboot delayed due to outstanding locks", "locks", _rebootLocks.elements());
broadcast("m.reboot_delayed");
_interval = new Interval(_omgr) {
@Override
@@ -135,7 +135,7 @@ public class ReportManager
try {
rptr.appendReport(report, now, sinceLast, reset);
} catch (Throwable t) {
log.warning("Reporter choked [rptr=" + rptr + "].", t);
log.warning("Reporter choked", "rptr", rptr, t);
}
}
@@ -395,8 +395,7 @@ public class ConnectionManager extends LoopingThread
log.info("Server accepting datagrams on " + isa + ".");
} catch (IOException ioe) {
log.warning("Failure opening datagram channel on port '" +
port + "'.", ioe);
log.warning("Failure opening datagram channel on port '" + port + "'.", ioe);
}
}
}
@@ -550,8 +549,7 @@ public class ConnectionManager extends LoopingThread
Set<SelectionKey> ready = null;
int eventCount;
try {
// log.debug("Selecting from " + StringUtil.toString(_selector.keys()) + " (" +
// SELECT_LOOP_TIME + ").");
// log.debug("Selecting from " + _selector.keys() + " (" + SELECT_LOOP_TIME + ").");
// check for incoming network events
eventCount = _selector.select(SELECT_LOOP_TIME);
@@ -602,7 +600,7 @@ public class ConnectionManager extends LoopingThread
continue;
}
// log.info("Got event [selkey=" + selkey + ", handler=" + handler + "].");
// log.info("Got event", "selkey", selkey, "handler", handler);
int got = handler.handleEvent(iterStamp);
if (got != 0) {
@@ -668,8 +666,8 @@ public class ConnectionManager extends LoopingThread
if (oqueue != null) {
int size = oqueue.size();
if ((size > 500) && (size % 50 == 0)) {
log.warning("Aiya, big overflow queue for " + conn + " [size=" + size +
", adding=" + tup.right + "].");
log.warning("Aiya, big overflow queue for " + conn + "", "size", size,
"adding", tup.right);
}
oqueue.add(tup.right);
continue;
@@ -717,7 +715,7 @@ public class ConnectionManager extends LoopingThread
if (data.length > _outbuf.capacity()) {
// increase the buffer size in large increments
int ncapacity = Math.max(_outbuf.capacity() << 1, data.length);
log.info("Expanding output buffer size [nsize=" + ncapacity + "].");
log.info("Expanding output buffer size", "nsize", ncapacity);
_outbuf = ByteBuffer.allocateDirect(ncapacity);
}
@@ -766,7 +764,7 @@ public class ConnectionManager extends LoopingThread
{
InetSocketAddress target = conn.getDatagramAddress();
if (target == null) {
log.warning("No address to send datagram [conn=" + conn + "].");
log.warning("No address to send datagram", "conn", conn);
return false;
}
@@ -859,8 +857,7 @@ public class ConnectionManager extends LoopingThread
// id, authentication hash, and a class reference)
int size = _databuf.flip().remaining();
if (size < 14) {
log.warning("Received undersized datagram [source=" + source +
", size=" + size + "].");
log.warning("Received undersized datagram", "source", source, "size", size);
return 0;
}
@@ -870,8 +867,8 @@ public class ConnectionManager extends LoopingThread
if (conn != null) {
conn.handleDatagram(source, _databuf, when);
} else {
log.warning("Received datagram for unknown connection [id=" + connectionId +
", source=" + source + "].");
log.warning("Received datagram for unknown connection", "id", connectionId,
"source", source);
}
// return the size of the datagram
@@ -1113,8 +1110,8 @@ public class ConnectionManager extends LoopingThread
_partial = null;
_partials++;
} else {
// log.info("Still going [conn=" + conn + ", wrote=" + wrote +
// ", remain=" + _partial.remaining() + "].");
// log.info("Still going", "conn", conn, "wrote", wrote,
// "remain", _partial.remaining());
return false;
}
}