Switch to new samskivert logging API.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5134 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2008-05-27 19:25:38 +00:00
parent 821760366f
commit 919112cf88
80 changed files with 440 additions and 573 deletions
+1 -26
View File
@@ -21,8 +21,7 @@
package com.threerings.admin;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.samskivert.util.Logger;
/**
* Contains a reference to the log object used by the Admin services.
@@ -31,28 +30,4 @@ public class Log
{
/** We dispatch our log messages through this logger. */
public static Logger log = Logger.getLogger("com.threerings.narya.admin");
/** Convenience function. */
public static void debug (String message)
{
log.fine(message);
}
/** Convenience function. */
public static void info (String message)
{
log.info(message);
}
/** Convenience function. */
public static void warning (String message)
{
log.warning(message);
}
/** Convenience function. */
public static void logStackTrace (Throwable t)
{
log.log(Level.WARNING, t.getMessage(), t);
}
}
@@ -29,7 +29,7 @@ import com.samskivert.util.StringUtil;
import com.threerings.presents.dobj.DObject;
import com.threerings.presents.util.PresentsContext;
import com.threerings.admin.Log;
import static com.threerings.admin.Log.log;
/**
* Used to display and edit a particular distributed object field.
@@ -89,7 +89,7 @@ public class AsStringFieldEditor extends FieldEditor
return new Boolean(_value.getText().equalsIgnoreCase("true"));
} else {
Log.warning("Unknown field type '" + _field.getName() + "': " +
log.warning("Unknown field type '" + _field.getName() + "': " +
_field.getType().getName() + ".");
return null;
}
@@ -30,7 +30,7 @@ import com.samskivert.swing.VGroupLayout;
import com.threerings.presents.util.PresentsContext;
import com.threerings.admin.Log;
import static com.threerings.admin.Log.log;
/**
* Fetches a list of the configuration objects in use by the server and
@@ -111,7 +111,7 @@ public class ConfigEditorPanel extends JPanel
// documentation inherited from interface
public void requestFailed (String reason)
{
Log.warning("Failed to get config info [reason=" + reason + "].");
log.warning("Failed to get config info [reason=" + reason + "].");
}
/** Our client context. */
@@ -32,10 +32,11 @@ import com.threerings.presents.dobj.DObjectManager;
import com.threerings.presents.dobj.ObjectAccessException;
import com.threerings.presents.dobj.Subscriber;
import com.threerings.admin.Log;
import com.threerings.admin.data.AdminCodes;
import com.threerings.admin.data.ConfigObject;
import static com.threerings.admin.Log.log;
/**
* Handles subscribing to admin config objects.
*/
@@ -84,7 +85,7 @@ public class ConfigObjectManager implements AdminService.ConfigInfoListener
// documentation inherited from interface AdminService.ConfigInfoListener
public void requestFailed (String reason)
{
Log.warning("Oh bugger, we didn't get the config data: " + reason);
log.warning("Oh bugger, we didn't get the config data: " + reason);
}
/**
@@ -121,7 +122,7 @@ public class ConfigObjectManager implements AdminService.ConfigInfoListener
// documentation inherited from interface Subscriber
public void requestFailed (int oid, ObjectAccessException cause) {
Log.warning("Unable to subscribe to config object " + _key);
log.warning("Unable to subscribe to config object " + _key);
}
/**
@@ -40,7 +40,6 @@ import com.samskivert.util.ClassUtil;
import com.samskivert.util.ComparableArrayList;
import com.samskivert.util.ListUtil;
import com.threerings.presents.Log;
import com.threerings.presents.dobj.AttributeChangeListener;
import com.threerings.presents.dobj.AttributeChangedEvent;
import com.threerings.presents.dobj.DObject;
@@ -50,6 +49,8 @@ import com.threerings.presents.dobj.EntryRemovedEvent;
import com.threerings.presents.dobj.EntryUpdatedEvent;
import com.threerings.presents.dobj.SetListener;
import static com.threerings.presents.Log.log;
/**
* Allows simple editing of DSets within a distributed object.
*/
@@ -43,7 +43,7 @@ import com.threerings.presents.dobj.DObject;
import com.threerings.presents.dobj.ObjectAccessException;
import com.threerings.presents.util.PresentsContext;
import com.threerings.admin.Log;
import static com.threerings.admin.Log.log;
/**
* Used to display and edit a particular distributed object field.
@@ -107,7 +107,7 @@ public abstract class FieldEditor extends JPanel
try {
_object.changeAttribute(_field.getName(), value);
} catch (ObjectAccessException oae) {
Log.warning("Failed to update field " + _field.getName() +
log.warning("Failed to update field " + _field.getName() +
": "+ oae);
}
}
@@ -128,7 +128,7 @@ public abstract class FieldEditor extends JPanel
try {
dvalue = getDisplayValue();
} catch (Exception e) {
Log.warning("Failed to parse display value " + e + ".");
log.warning("Failed to parse display value " + e + ".");
displayValue(getValue());
}
updateBorder(!ObjectUtil.equals(dvalue, getValue()));
@@ -154,7 +154,7 @@ public abstract class FieldEditor extends JPanel
try {
return _field.get(_object);
} catch (Exception e) {
Log.warning("Failed to fetch field [field=" + _field +
log.warning("Failed to fetch field [field=" + _field +
", object=" + _object + ", error=" + e + "].");
return null;
}
@@ -37,9 +37,10 @@ import com.threerings.presents.dobj.Subscriber;
import com.threerings.presents.util.PresentsContext;
import com.threerings.presents.util.SafeSubscriber;
import com.threerings.admin.Log;
import com.threerings.admin.data.ConfigObject;
import static com.threerings.admin.Log.log;
/**
* Used to edit the distributed object fields of a particular
* configuration object. When the panel is first shown, it will subscribe
@@ -111,7 +112,7 @@ public class ObjectEditorPanel extends ScrollablePanel
}
} catch (SecurityException se) {
Log.warning("Unable to introspect DObject!? " + se);
log.warning("Unable to introspect DObject!? " + se);
}
SwingUtil.refresh(this);
@@ -120,7 +121,7 @@ public class ObjectEditorPanel extends ScrollablePanel
// documentation inherited from interface
public void requestFailed (int oid, ObjectAccessException cause)
{
Log.warning("Unable to subscribe to config object: " + cause);
log.warning("Unable to subscribe to config object: " + cause);
}
protected PresentsContext _ctx;
@@ -30,7 +30,7 @@ import com.samskivert.util.ObjectUtil;
import com.threerings.presents.dobj.DObject;
import com.threerings.presents.util.PresentsContext;
import com.threerings.admin.Log;
import static com.threerings.admin.Log.log;
/**
* Allows editing of a dobj field using a pulldown.
@@ -132,7 +132,7 @@ public class PulldownFieldEditor extends FieldEditor
}
// cause shit to blow up minorly
Log.warning("Value in dobj is not settable, disabling choice.");
log.warning("Value in dobj is not settable, disabling choice.");
Thread.dumpStack();
_value.setEnabled(false);
}
@@ -30,7 +30,6 @@ import java.util.HashMap;
import com.samskivert.io.ByteArrayOutInputStream;
import com.samskivert.util.StringUtil;
import com.threerings.admin.Log;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.Streamable;
@@ -47,6 +46,8 @@ import com.threerings.presents.dobj.EntryUpdatedEvent;
import com.threerings.presents.dobj.ObjectAccessException;
import com.threerings.presents.dobj.SetListener;
import static com.threerings.admin.Log.log;
/**
* Provides a registry of configuration distributed objects. Using distributed object to store
* runtime configuration data can be exceptionally useful in that clients (with admin privileges)
@@ -166,7 +167,7 @@ public abstract class ConfigRegistry
object.addListener(this);
} catch (SecurityException se) {
Log.warning("Unable to reflect on " + cclass.getName() + ": " + se + ". " +
log.warning("Unable to reflect on " + cclass.getName() + ": " + se + ". " +
"Refusing to monitor object.");
}
}
@@ -196,7 +197,7 @@ public abstract class ConfigRegistry
try {
value = object.getAttribute(event.getName());
} catch (ObjectAccessException oae) {
Log.warning("Exception getting field [name=" + event.getName() +
log.warning("Exception getting field [name=" + event.getName() +
", exception=" + oae + "].");
return;
}
@@ -239,7 +240,7 @@ public abstract class ConfigRegistry
} else if (value instanceof long[]) {
setValue(key, (long[]) value);
} else {
Log.info("Unable to flush config obj change [cobj=" + object.getClass().getName() +
log.info("Unable to flush config obj change [cobj=" + object.getClass().getName() +
", key=" + key + ", type=" + value.getClass().getName() +
", value=" + value + "].");
}
@@ -314,18 +315,18 @@ public abstract class ConfigRegistry
serialize(key, nameToKey(key), deserializedValue);
}
} catch (Exception e) {
Log.warning("Failure decoding config value [type=" + type +
log.warning("Failure decoding config value [type=" + type +
", field=" + field + ", exception=" + e + "].");
}
} else {
Log.warning("Can't init field of unknown type " +
log.warning("Can't init field of unknown type " +
"[cobj=" + object.getClass().getName() + ", key=" + key +
", type=" + type.getName() + "].");
}
} catch (IllegalAccessException iae) {
Log.warning("Can't set field [cobj=" + object.getClass().getName() +
log.warning("Can't set field [cobj=" + object.getClass().getName() +
", key=" + key + ", error=" + iae + "].");
}
}
@@ -340,7 +341,7 @@ public abstract class ConfigRegistry
try {
value = object.getAttribute(attributeName);
} catch (ObjectAccessException oae) {
Log.warning("Exception getting field [name=" + attributeName +
log.warning("Exception getting field [name=" + attributeName +
", error=" + oae + "].");
return;
}
@@ -348,7 +349,7 @@ public abstract class ConfigRegistry
if (value instanceof Streamable) {
serialize(attributeName, key, value);
} else {
Log.info("Unable to flush config obj change [cobj=" + object.getClass().getName() +
log.info("Unable to flush config obj change [cobj=" + object.getClass().getName() +
", key=" + key + ", type=" + value.getClass().getName() +
", value=" + value + "].");
}
@@ -366,7 +367,7 @@ public abstract class ConfigRegistry
oout.flush();
setValue(key, StringUtil.hexlate(out.toByteArray()));
} catch (IOException ioe) {
Log.info("Error serializing value " + value);
log.info("Error serializing value " + value);
}
}
@@ -31,9 +31,10 @@ import com.samskivert.util.StringUtil;
import com.threerings.presents.dobj.DObject;
import com.threerings.admin.Log;
import com.threerings.admin.server.persist.ConfigRepository;
import static com.threerings.admin.Log.log;
/**
* Implements the {@link ConfigRegistry} using a JDBC database as a persistent store for the
* configuration information. <em>Note:</em> config objects should only be created during server
@@ -130,8 +131,7 @@ public class DatabaseConfigRegistry extends ConfigRegistry
try {
_data = _repo.loadConfig(_node, _path);
} catch (PersistenceException pe) {
Log.warning("Failed to load object configuration [path=" + _path + "].");
Log.logStackTrace(pe);
log.warning("Failed to load object configuration [path=" + _path + "].", pe);
_data = new HashMap<String,String>();
}
@@ -22,7 +22,6 @@
package com.threerings.admin.server;
import java.util.ArrayList;
import java.util.logging.Level;
import com.samskivert.io.PersistenceException;
import com.samskivert.jdbc.depot.PersistenceContext;
@@ -79,7 +78,7 @@ public class PeeredDatabaseConfigRegistry extends DatabaseConfigRegistry
object.changeAttribute(change.left, change.right);
_pendingSyncs.add(change.left);
} catch (Exception e) {
log.log(Level.WARNING, "Config attribute sync failed " + change + ".", e);
log.warning("Config attribute sync failed " + change + ".", e);
}
}