From 19e6b9adf6a1cf47eab66b965b86680fd62f81c4 Mon Sep 17 00:00:00 2001 From: samskivert Date: Fri, 13 Mar 2009 22:40:08 +0000 Subject: [PATCH] Varargification. git-svn-id: https://samskivert.googlecode.com/svn/trunk@2537 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- src/java/com/samskivert/io/StreamUtil.java | 8 +++--- src/java/com/samskivert/jdbc/JDBCUtil.java | 12 ++++---- .../com/samskivert/jdbc/LiaisonRegistry.java | 6 ++-- .../com/samskivert/jdbc/SimpleRepository.java | 19 ++++++------- .../jdbc/StaticConnectionProvider.java | 5 ++-- .../samskivert/jdbc/TransitionRepository.java | 8 +++--- src/java/com/samskivert/jdbc/jora/Cursor.java | 5 ++-- .../samskivert/net/AttachableURLFactory.java | 4 +-- .../samskivert/servlet/MessageManager.java | 14 ++++------ .../servlet/SiteResourceLoader.java | 7 ++--- .../samskivert/servlet/user/UserManager.java | 11 ++++---- .../samskivert/servlet/util/ExceptionMap.java | 5 ++-- .../com/samskivert/swing/AbsoluteLayout.java | 6 ++-- src/java/com/samskivert/swing/Controller.java | 28 +++++++------------ .../com/samskivert/swing/EnablingAdapter.java | 4 +-- src/java/com/samskivert/swing/Label.java | 6 ++-- .../com/samskivert/swing/RuntimeAdjust.java | 13 ++++----- .../com/samskivert/swing/util/MenuUtil.java | 10 +++---- src/java/com/samskivert/util/AuditLogger.java | 8 ++---- src/java/com/samskivert/util/Config.java | 20 +++++-------- src/java/com/samskivert/util/ConfigUtil.java | 15 ++++------ src/java/com/samskivert/util/DebugChords.java | 2 +- src/java/com/samskivert/util/FileUtil.java | 12 +++----- src/java/com/samskivert/util/Interval.java | 4 +-- src/java/com/samskivert/util/Invoker.java | 2 +- src/java/com/samskivert/util/PrefsConfig.java | 6 ++-- src/java/com/samskivert/util/RunAnywhere.java | 5 ++-- .../velocity/DispatcherServlet.java | 14 +++++----- .../velocity/SiteJarResourceLoader.java | 10 +++---- src/java/com/samskivert/velocity/SiteKey.java | 2 +- src/java/com/samskivert/xml/SimpleParser.java | 2 +- 31 files changed, 114 insertions(+), 159 deletions(-) diff --git a/src/java/com/samskivert/io/StreamUtil.java b/src/java/com/samskivert/io/StreamUtil.java index 8e5f2b61..3b0f1306 100644 --- a/src/java/com/samskivert/io/StreamUtil.java +++ b/src/java/com/samskivert/io/StreamUtil.java @@ -42,7 +42,7 @@ public class StreamUtil try { in.close(); } catch (IOException ioe) { - log.warning("Error closing input stream [stream=" + in + ", cause=" + ioe + "]."); + log.warning("Error closing input stream", "stream", in, "cause", ioe); } } } @@ -56,7 +56,7 @@ public class StreamUtil try { out.close(); } catch (IOException ioe) { - log.warning("Error closing output stream [stream=" + out + ", cause=" + ioe + "]."); + log.warning("Error closing output stream", "stream", out, "cause", ioe); } } } @@ -70,7 +70,7 @@ public class StreamUtil try { in.close(); } catch (IOException ioe) { - log.warning("Error closing reader [reader=" + in + ", cause=" + ioe + "]."); + log.warning("Error closing reader", "reader", in, "cause", ioe); } } } @@ -84,7 +84,7 @@ public class StreamUtil try { out.close(); } catch (IOException ioe) { - log.warning("Error closing writer [writer=" + out + ", cause=" + ioe + "]."); + log.warning("Error closing writer", "writer", out, "cause", ioe); } } } diff --git a/src/java/com/samskivert/jdbc/JDBCUtil.java b/src/java/com/samskivert/jdbc/JDBCUtil.java index 5928d04d..5fd43da7 100644 --- a/src/java/com/samskivert/jdbc/JDBCUtil.java +++ b/src/java/com/samskivert/jdbc/JDBCUtil.java @@ -115,8 +115,8 @@ public class JDBCUtil { int modified = stmt.executeUpdate(); if (modified != expectedCount) { - log.warning("Statement did not modify expected number of rows [stmt=" + stmt + - ", expected=" + expectedCount + ", modified=" + modified + "]"); + log.warning("Statement did not modify expected number of rows", "stmt", stmt, + "expected", expectedCount, "modified", modified); } } @@ -184,8 +184,8 @@ public class JDBCUtil { int modified = stmt.executeUpdate(query); if (modified != expectedCount) { - log.warning("Statement did not modify expected number of rows [stmt=" + stmt + - ", expected=" + expectedCount + ", modified=" + modified + "]"); + log.warning("Statement did not modify expected number of rows", "stmt", stmt, + "expected", expectedCount, "modified", modified); } } @@ -231,7 +231,7 @@ public class JDBCUtil try { return new String(text.getBytes("UTF8"), "8859_1"); } catch (UnsupportedEncodingException uee) { - log.warning("jigger failed", uee); + log.warning("Jigger failed", uee); return text; } } @@ -247,7 +247,7 @@ public class JDBCUtil try { return new String(text.getBytes("8859_1"), "UTF8"); } catch (UnsupportedEncodingException uee) { - log.warning("unjigger failed", uee); + log.warning("Unjigger failed", uee); return text; } } diff --git a/src/java/com/samskivert/jdbc/LiaisonRegistry.java b/src/java/com/samskivert/jdbc/LiaisonRegistry.java index 7ae79adc..7565522b 100644 --- a/src/java/com/samskivert/jdbc/LiaisonRegistry.java +++ b/src/java/com/samskivert/jdbc/LiaisonRegistry.java @@ -52,8 +52,7 @@ public class LiaisonRegistry // if we didn't find a matching liaison, use the default if (liaison == null) { - log.warning("Unable to match liaison for database [url=" + url + "]. " + - "Using default."); + log.warning("Unable to match liaison for database. Using default.", "url", url); liaison = new DefaultLiaison(); } @@ -79,8 +78,7 @@ public class LiaisonRegistry try { _liaisons.add(lclass.newInstance()); } catch (Exception e) { - log.warning("Unable to instantiate liaison [class=" + lclass.getName() + - ", error=" + e + "]."); + log.warning("Unable to instantiate liaison", "class", lclass.getName(), "error", e); } } diff --git a/src/java/com/samskivert/jdbc/SimpleRepository.java b/src/java/com/samskivert/jdbc/SimpleRepository.java index c4b3e170..158952de 100644 --- a/src/java/com/samskivert/jdbc/SimpleRepository.java +++ b/src/java/com/samskivert/jdbc/SimpleRepository.java @@ -91,7 +91,7 @@ public class SimpleRepository extends Repository } }); } catch (PersistenceException pe) { - log.warning("Failure migrating schema [dbident=" + _dbident + "].", pe); + log.warning("Failure migrating schema", "dbident", _dbident, pe); } } @@ -143,8 +143,8 @@ public class SimpleRepository extends Repository // check our pre-condition if (_precond != null && !_precond.validate(_dbident, op)) { - log.warning("Repository operation failed pre-condition check! [dbident=" + _dbident + - ", op=" + op + "]."); + log.warning("Repository operation failed pre-condition check!", "dbident", _dbident, + "op", op); Thread.dumpStack(); } @@ -193,8 +193,7 @@ public class SimpleRepository extends Repository conn.rollback(); } } catch (SQLException rbe) { - log.warning("Unable to roll back operation [err=" + sqe + - ", rberr=" + rbe + "]."); + log.warning("Unable to roll back operation", "err", sqe, "rberr", rbe); } } @@ -215,7 +214,7 @@ public class SimpleRepository extends Repository // stack trace in the message of their outer exception; if I want a fucking stack // trace, I'll call printStackTrace() thanksverymuch String msg = StringUtil.split("" + sqe, "\n")[0]; - log.info("Transient failure executing operation, retrying [error=" + msg + "]."); + log.info("Transient failure executing operation, retrying", "error", msg); } catch (PersistenceException pe) { // back out our changes if something got hosed @@ -224,8 +223,7 @@ public class SimpleRepository extends Repository conn.rollback(); } } catch (SQLException rbe) { - log.warning("Unable to roll back operation [origerr=" + pe + - ", rberr=" + rbe + "]."); + log.warning("Unable to roll back operation", "origerr", pe, "rberr", rbe); } throw pe; @@ -236,8 +234,7 @@ public class SimpleRepository extends Repository conn.rollback(); } } catch (SQLException rbe) { - log.warning("Unable to roll back operation [origerr=" + rte + - ", rberr=" + rbe + "]."); + log.warning("Unable to roll back operation", "origerr", rte, "rberr", rbe); } throw rte; @@ -249,7 +246,7 @@ public class SimpleRepository extends Repository conn.setAutoCommit(oldAutoCommit); } } catch (SQLException sace) { - log.warning("Unable to restore auto-commit [err=" + sace + "]."); + log.warning("Unable to restore auto-commit", "err", sace); } // release the database connection _provider.releaseConnection(_dbident, readOnly, conn); diff --git a/src/java/com/samskivert/jdbc/StaticConnectionProvider.java b/src/java/com/samskivert/jdbc/StaticConnectionProvider.java index ba621f89..01fd17a5 100644 --- a/src/java/com/samskivert/jdbc/StaticConnectionProvider.java +++ b/src/java/com/samskivert/jdbc/StaticConnectionProvider.java @@ -188,7 +188,7 @@ public class StaticConnectionProvider implements ConnectionProvider String mapkey = ident + ":" + readOnly; Mapping conmap = _idents.get(mapkey); if (conmap == null) { - log.warning("Unknown connection failed!? [key=" + mapkey + "]."); + log.warning("Unknown connection failed!?", "key", mapkey); return; } @@ -251,8 +251,7 @@ public class StaticConnectionProvider implements ConnectionProvider try { conn.close(); } catch (SQLException sqe) { - log.warning("Error closing failed connection [ident=" + ident + - ", error=" + sqe + "]."); + log.warning("Error closing failed connection", "ident", ident, "error", sqe); } } diff --git a/src/java/com/samskivert/jdbc/TransitionRepository.java b/src/java/com/samskivert/jdbc/TransitionRepository.java index 401da80d..e9a998c5 100644 --- a/src/java/com/samskivert/jdbc/TransitionRepository.java +++ b/src/java/com/samskivert/jdbc/TransitionRepository.java @@ -73,8 +73,8 @@ public class TransitionRepository extends SimpleRepository try { clearTransition(clazz, name); } catch (PersistenceException pe) { - log.warning("Failed to clear failed transition [class=" + clazz + - ", name=" + name + "].", pe); + log.warning("Failed to clear failed transition", "class", clazz, "name", name, + pe); } throw e; @@ -82,8 +82,8 @@ public class TransitionRepository extends SimpleRepository try { clearTransition(clazz, name); } catch (PersistenceException pe) { - log.warning("Failed to clear failed transition [class=" + clazz + - ", name=" + name + "].", pe); + log.warning("Failed to clear failed transition", "class", clazz, "name", name, + pe); } throw rte; } diff --git a/src/java/com/samskivert/jdbc/jora/Cursor.java b/src/java/com/samskivert/jdbc/jora/Cursor.java index 4fe38ba5..5b636baf 100644 --- a/src/java/com/samskivert/jdbc/jora/Cursor.java +++ b/src/java/com/samskivert/jdbc/jora/Cursor.java @@ -96,9 +96,8 @@ public class Cursor spurious++; } if (spurious > 0) { - log.warning("Cursor.get() quietly tossed " + spurious + - " spurious additional records. " + - "[query=" + _query + "]."); + log.warning("Cursor.get() quietly tossed " + spurious + " spurious additional " + + "records.", "query", _query); } } return result; diff --git a/src/java/com/samskivert/net/AttachableURLFactory.java b/src/java/com/samskivert/net/AttachableURLFactory.java index fefb234e..05332136 100644 --- a/src/java/com/samskivert/net/AttachableURLFactory.java +++ b/src/java/com/samskivert/net/AttachableURLFactory.java @@ -92,8 +92,8 @@ public class AttachableURLFactory implements URLStreamHandlerFactory try { return handler.newInstance(); } catch (Exception e) { - log.warning("Unable to instantiate URLStreamHandler" + - " [protocol=" + protocol + ", cause=" + e + "]."); + log.warning("Unable to instantiate URLStreamHandler", "protocol", protocol, + "cause", e); } } return null; diff --git a/src/java/com/samskivert/servlet/MessageManager.java b/src/java/com/samskivert/servlet/MessageManager.java index 67a221e6..c16db666 100644 --- a/src/java/com/samskivert/servlet/MessageManager.java +++ b/src/java/com/samskivert/servlet/MessageManager.java @@ -184,8 +184,7 @@ public class MessageManager if (reportMissing) { // if there's no translation for this path, complain about it - log.warning("Missing translation message [path=" + path + - ", url=" + getURL(req) + "]."); + log.warning("Missing translation message", "path", path, "url", getURL(req)); return path; } @@ -218,8 +217,8 @@ public class MessageManager try { siteLoader = _siteLoader.getSiteClassLoader(siteId); } catch (IOException ioe) { - log.warning("Unable to fetch site-specific classloader " + - "[siteId=" + siteId + ", error=" + ioe + "]."); + log.warning("Unable to fetch site-specific classloader", "siteId", siteId, + "error", ioe); } } } @@ -293,10 +292,9 @@ public class MessageManager if (!silent) { // if we were unable even to find a default bundle, we may want to log a // warning - log.warning("Unable to resolve any message bundle [req=" + getURL(req) + - ", locale=" + locale + ", bundlePath=" + bundlePath + - ", classLoader=" + loader + ", siteBundlePath=" + _siteBundlePath + - ", siteLoader=" + _siteLoader + "]."); + log.warning("Unable to resolve any message bundle", "req", getURL(req), + "locale", locale, "bundlePath", bundlePath, "classLoader", loader, + "siteBundlePath", _siteBundlePath, "siteLoader", _siteLoader); } } } diff --git a/src/java/com/samskivert/servlet/SiteResourceLoader.java b/src/java/com/samskivert/servlet/SiteResourceLoader.java index 6a30585f..8b450e92 100644 --- a/src/java/com/samskivert/servlet/SiteResourceLoader.java +++ b/src/java/com/samskivert/servlet/SiteResourceLoader.java @@ -313,7 +313,7 @@ public class SiteResourceLoader jarFile.close(); } - log.info("Opened site bundle [path=" + file.getPath() + "]."); + log.info("Opened site bundle", "path", file.getPath()); // and open a new one jarFile = new JarFile(file); @@ -337,9 +337,8 @@ public class SiteResourceLoader try { return _bundle.getResourceAsStream(path); } catch (IOException ioe) { - log.warning("Error loading resource from jarfile " + - "[bundle=" + _bundle + ", path=" + path + - ", error=" + ioe + "]."); + log.warning("Error loading resource from jarfile", "bundle", _bundle, "path", path, + "error", ioe); return null; } } diff --git a/src/java/com/samskivert/servlet/user/UserManager.java b/src/java/com/samskivert/servlet/user/UserManager.java index 14451e87..924cc29e 100644 --- a/src/java/com/samskivert/servlet/user/UserManager.java +++ b/src/java/com/samskivert/servlet/user/UserManager.java @@ -135,8 +135,7 @@ public class UserManager } if (USERMGR_DEBUG) { - log.info("UserManager initialized [acook=" + _userAuthCookie + - ", login=" + _loginURL + "]."); + log.info("UserManager initialized", "acook", _userAuthCookie, "login", _loginURL); } // register a cron job to prune the session table every hour @@ -181,7 +180,7 @@ public class UserManager { String authcook = CookieUtil.getCookieValue(req, _userAuthCookie); if (USERMGR_DEBUG) { - log.info("Loading user by cookie [" + _userAuthCookie + "=" + authcook + "]."); + log.info("Loading user by cookie", _userAuthCookie, authcook); } return loadUser(authcook); } @@ -194,7 +193,7 @@ public class UserManager { User user = (authcode == null) ? null : _repository.loadUserBySession(authcode); if (USERMGR_DEBUG) { - log.info("Loaded user by authcode [code=" + authcode + ", user=" + user + "]."); + log.info("Loaded user by authcode", "code", authcode, "user", user); } return user; } @@ -217,7 +216,7 @@ public class UserManager String eurl = RequestUtils.getLocationEncoded(req); String target = StringUtil.replace(_loginURL, "%R", eurl); if (USERMGR_DEBUG) { - log.info("No user found in require, redirecting [to=" + target + "]."); + log.info("No user found in require, redirecting", "to", target); } throw new RedirectException(target); } @@ -304,7 +303,7 @@ public class UserManager // register a session for this user String authcode = _repository.registerSession(user, expires); if (USERMGR_DEBUG) { - log.info("Session started [user=" + username + ", code=" + authcode + "]."); + log.info("Session started", "user", username, "code", authcode); } return new Tuple(user, authcode); } diff --git a/src/java/com/samskivert/servlet/util/ExceptionMap.java b/src/java/com/samskivert/servlet/util/ExceptionMap.java index 3167fa5e..8193832e 100644 --- a/src/java/com/samskivert/servlet/util/ExceptionMap.java +++ b/src/java/com/samskivert/servlet/util/ExceptionMap.java @@ -117,9 +117,8 @@ public class ExceptionMap _keys.add(cl); } catch (Throwable t) { - log.warning("Unable to resolve exception class. " + - "[class=" + exclass + - ", error=" + t + "]."); + log.warning("Unable to resolve exception class.", "class", exclass, + "error", t); _values.remove(i); i--; // back on up a notch } diff --git a/src/java/com/samskivert/swing/AbsoluteLayout.java b/src/java/com/samskivert/swing/AbsoluteLayout.java index 7268ca05..f9930639 100644 --- a/src/java/com/samskivert/swing/AbsoluteLayout.java +++ b/src/java/com/samskivert/swing/AbsoluteLayout.java @@ -85,8 +85,7 @@ public class AbsoluteLayout Object constr = _constraints.get(comp); if (constr == null) { - log.warning("No constraints for child!? [cont=" + parent + - ", comp=" + comp + "]."); + log.warning("No constraints for child!?", "cont", parent, "comp", comp); continue; } @@ -137,8 +136,7 @@ public class AbsoluteLayout Object constr = _constraints.get(comp); if (constr == null) { - log.warning("No constraints for child!? [cont=" + parent + - ", comp=" + comp + "]."); + log.warning("No constraints for child!?", "cont", parent, "comp", comp); continue; } diff --git a/src/java/com/samskivert/swing/Controller.java b/src/java/com/samskivert/swing/Controller.java index 650035ec..dc5fccd6 100644 --- a/src/java/com/samskivert/swing/Controller.java +++ b/src/java/com/samskivert/swing/Controller.java @@ -297,8 +297,8 @@ public abstract class Controller } } catch (Exception e) { - log.warning("Error searching for action handler method " + - "[controller=" + this + ", action=" + action + "]."); + log.warning("Error searching for action handler method", "controller", this, + "action", action); return false; } @@ -311,8 +311,7 @@ public abstract class Controller } } catch (Exception e) { - log.warning("Error invoking action handler [controller=" + this + - ", action=" + action + "].", e); + log.warning("Error invoking action handler", "controller", this, "action", action, e); // even though we choked, we still "handled" the action return true; } @@ -368,10 +367,8 @@ public abstract class Controller if (argument != null) { return new Object[] { source, argument }; } - - log.warning("Unable to map argumentless event to handler method " + - "that requires an argument [controller=" + this + - ", method=" + method + ", source=" + source + "]."); + log.warning("Unable to map argumentless event to handler method that requires an " + + "argument", "controller", this, "method", method, "source", source); } // we would have handled it, but we couldn't @@ -394,9 +391,8 @@ public abstract class Controller // do some sanity checking on the source Object src = _action.getSource(); if (src == null || !(src instanceof Component)) { - log.warning("Requested to dispatch action on " + - "non-component source [source=" + src + - ", action=" + _action + "]."); + log.warning("Requested to dispatch action on non-component source", "source", src, + "action", _action); return; } @@ -410,8 +406,7 @@ public abstract class Controller Controller ctrl = ((ControllerProvider)source).getController(); if (ctrl == null) { - log.warning("Provider returned null controller " + - "[provider=" + source + "]."); + log.warning("Provider returned null controller", "provider", source); continue; } @@ -423,15 +418,12 @@ public abstract class Controller } } catch (Exception e) { - log.warning("Controller choked on action " + - "[ctrl=" + ctrl + - ", action=" + _action + "].", e); + log.warning("Controller choked on action", "ctrl", ctrl, "action", _action, e); } } // if we got here, we didn't find a controller - log.warning("Unable to find a controller to process action " + - "[action=" + _action + "]."); + log.warning("Unable to find a controller to process action", "action", _action); } protected ActionEvent _action; diff --git a/src/java/com/samskivert/swing/EnablingAdapter.java b/src/java/com/samskivert/swing/EnablingAdapter.java index 08d16034..36f6138e 100644 --- a/src/java/com/samskivert/swing/EnablingAdapter.java +++ b/src/java/com/samskivert/swing/EnablingAdapter.java @@ -83,8 +83,8 @@ public class EnablingAdapter if (value instanceof Boolean) { stateChanged(((Boolean)value).booleanValue()); } else { - log.warning("PropertyChangeEnabler connected to " + - "non-Boolean property [got=" + value + "]."); + log.warning("PropertyChangeEnabler connected to non-Boolean property", + "got", value); } } } diff --git a/src/java/com/samskivert/swing/Label.java b/src/java/com/samskivert/swing/Label.java index 99df6b2d..a8c55276 100644 --- a/src/java/com/samskivert/swing/Label.java +++ b/src/java/com/samskivert/swing/Label.java @@ -515,7 +515,7 @@ public class Label implements SwingConstants, LabelStyleConstants } } catch (Throwable t) { - log.warning("Label layout failed [text=" + _text + "].", t); + log.warning("Label layout failed", "text", _text, t); } return layouts; @@ -528,8 +528,8 @@ public class Label implements SwingConstants, LabelStyleConstants { // nothing to do if we haven't been laid out if (_layouts == null) { - log.warning(hashCode() + " Unlaid-out label asked to render [text=" + _text + - /* ", last=" + _invalidator + */ "]."); + log.warning(hashCode() + " Unlaid-out label asked to render", "text", _text + /*, "last", _invalidator */); return; } diff --git a/src/java/com/samskivert/swing/RuntimeAdjust.java b/src/java/com/samskivert/swing/RuntimeAdjust.java index 35bb4b5b..5b150d1a 100644 --- a/src/java/com/samskivert/swing/RuntimeAdjust.java +++ b/src/java/com/samskivert/swing/RuntimeAdjust.java @@ -279,9 +279,8 @@ public class RuntimeAdjust public void setValue (String value) { if (!ListUtil.contains(_values, value)) { - log.warning("Refusing invalid adjustment [name=" + _name + - ", values=" + StringUtil.toString(_values) + - ", value=" + value + "]."); + log.warning("Refusing invalid adjustment", "name", _name, "values", _values, + "value", value); } else { _config.setValue(_name, value); } @@ -486,8 +485,7 @@ public class RuntimeAdjust // validate the structure of the name int fdidx = _name.indexOf("."), ldidx = _name.lastIndexOf("."); if (fdidx == -1 || ldidx == -1) { - log.warning("Invalid adjustment name '" + _name + - "', must be of the form " + + log.warning("Invalid adjustment name '" + _name + "', must be of the form " + "'library.package.adjustment'."); return; } @@ -495,9 +493,8 @@ public class RuntimeAdjust // make sure there isn't another with the same name int idx = _adjusts.binarySearch(this); if (idx >= 0) { - log.warning("Error: duplicate adjust registration " + - "[new=" + this + - ", old=" + _adjusts.get(idx) + "]."); + log.warning("Error: duplicate adjust registration", "new", this, + "old", _adjusts.get(idx)); return; } diff --git a/src/java/com/samskivert/swing/util/MenuUtil.java b/src/java/com/samskivert/swing/util/MenuUtil.java index 242916f0..630db567 100644 --- a/src/java/com/samskivert/swing/util/MenuUtil.java +++ b/src/java/com/samskivert/swing/util/MenuUtil.java @@ -226,9 +226,8 @@ public class MenuUtil _target = target; } catch (Exception e) { - log.warning("Unable to obtain menu callback method " + - "[target=" + target + ", method=" + _method + - ", error=" + e + "]. Item will not function."); + log.warning("Unable to obtain menu callback method. Item will not function.", + "target", target, "method", _method, "error", e); } } @@ -238,9 +237,8 @@ public class MenuUtil try { _method.invoke(_target, new Object[] { event }); } catch (Exception e) { - log.warning("Failure invoking menu callback " + - "[target=" + _target + - ", method=" + _method + "].", e); + log.warning("Failure invoking menu callback", "target", _target, + "method", _method, e); } } } diff --git a/src/java/com/samskivert/util/AuditLogger.java b/src/java/com/samskivert/util/AuditLogger.java index 19ba57e9..c7e82106 100644 --- a/src/java/com/samskivert/util/AuditLogger.java +++ b/src/java/com/samskivert/util/AuditLogger.java @@ -93,8 +93,7 @@ public class AuditLogger log.warning("Suppressed " + _throttled + " intervening error messages."); _throttled = 0; } - log.warning("Failed to write audit log message [file=" + _logPath + - ", msg=" + message + "]."); + log.warning("Failed to write audit log message", "file", _logPath, "msg", message); } } } @@ -131,7 +130,7 @@ public class AuditLogger if (freakout) { throw new RuntimeException(errmsg, ioe); } else { - log.warning(errmsg + " [ioe=" + ioe + "]."); + log.warning(errmsg, "ioe", ioe); } } } @@ -153,8 +152,7 @@ public class AuditLogger // rename the old file String npath = _logPath.getPath() + "." + _dayStamp; if (!_logPath.renameTo(new File(npath))) { - log.warning("Failed to rename audit log file [path=" + _logPath + - ", npath=" + npath + "]."); + log.warning("Failed to rename audit log file", "path", _logPath, "npath", npath); } // open our new log file diff --git a/src/java/com/samskivert/util/Config.java b/src/java/com/samskivert/util/Config.java index 0217831b..65464fc7 100644 --- a/src/java/com/samskivert/util/Config.java +++ b/src/java/com/samskivert/util/Config.java @@ -134,7 +134,7 @@ public class Config try { return Integer.decode(val).intValue(); // handles base 10, hex values, etc. } catch (NumberFormatException nfe) { - log.warning("Malformed integer property [name=" + name + ", value=" + val + "]."); + log.warning("Malformed integer property", "name", name, "value", val); } } return defval; @@ -159,8 +159,7 @@ public class Config try { defval = Long.parseLong(val); } catch (NumberFormatException nfe) { - log.warning("Malformed long integer property [name=" + name + - ", value=" + val + "]."); + log.warning("Malformed long integer property", "name", name, "value", val); } } return defval; @@ -185,8 +184,7 @@ public class Config try { defval = Float.parseFloat(val); } catch (NumberFormatException nfe) { - log.warning("Malformed float property [name=" + name + - ", value=" + val + "]."); + log.warning("Malformed float property", "name", name, "value", val); } } return defval; @@ -248,8 +246,7 @@ public class Config if (val != null) { result = StringUtil.parseIntArray(val); if (result == null) { - log.warning("Malformed int array property [name=" + name + - ", value=" + val + "]."); + log.warning("Malformed int array property", "name", name, "value", val); return defval; } } @@ -279,8 +276,7 @@ public class Config if (val != null) { result = StringUtil.parseLongArray(val); if (result == null) { - log.warning("Malformed int array property [name=" + name + - ", value=" + val + "]."); + log.warning("Malformed int array property", "name", name, "value", val); return defval; } } @@ -310,8 +306,7 @@ public class Config if (val != null) { result = StringUtil.parseFloatArray(val); if (result == null) { - log.warning("Malformed int array property [name=" + name + - ", value=" + val + "]."); + log.warning("Malformed int array property", "name", name, "value", val); return defval; } } @@ -341,8 +336,7 @@ public class Config if (val != null) { result = StringUtil.parseStringArray(val); if (result == null) { - log.warning("Malformed string array property [name=" + name + - ", value=" + val + "]."); + log.warning("Malformed string array property", "name", name, "value", val); return defval; } } diff --git a/src/java/com/samskivert/util/ConfigUtil.java b/src/java/com/samskivert/util/ConfigUtil.java index 1eb89d2a..b060cadd 100644 --- a/src/java/com/samskivert/util/ConfigUtil.java +++ b/src/java/com/samskivert/util/ConfigUtil.java @@ -47,8 +47,7 @@ public class ConfigUtil try { value = Integer.parseInt(valstr); } catch (NumberFormatException nfe) { - log.warning("'" + key + "' must be a numeric value " + - "[value=" + valstr + ", error=" + nfe + "]."); + log.warning("'" + key + "' must be a numeric value", "value", valstr, "error", nfe); } } return value; @@ -282,9 +281,9 @@ public class ConfigUtil InputStream in = getStream(path, loader); if (in != null) { log.warning("Buggy classloader: getResources() returned no resources, but " + - "getResourceAsStream() returned a resource [path=" + path + - ", loader=" + StringUtil.shortClassName(loader) + - "]. Using the one we could get our hands on."); + "getResourceAsStream() returned a resource. Using the one we could " + + "get our hands on.", "path", path, + "loader", StringUtil.shortClassName(loader)); target.load(in); in.close(); } @@ -532,8 +531,7 @@ public class ConfigUtil { // make sure the class loader isn't null if (loader == null) { -// Log.debug("No loader for get resource request " + -// "[path=" + path + "]."); +// log.debug("No loader for get resource request", "path", path); return null; } // try the path as is @@ -550,8 +548,7 @@ public class ConfigUtil { // make sure the class loader isn't null if (loader == null) { -// Log.debug("No loader for get resource request " + -// "[path=" + path + "]."); +// log.debug("No loader for get resource request", "path", path); return null; } // try the path as is diff --git a/src/java/com/samskivert/util/DebugChords.java b/src/java/com/samskivert/util/DebugChords.java index 1cb7d1aa..e2fa9af1 100644 --- a/src/java/com/samskivert/util/DebugChords.java +++ b/src/java/com/samskivert/util/DebugChords.java @@ -126,7 +126,7 @@ public class DebugChords tup.right.invoke(); handled = true; } catch (Throwable t) { - log.warning("Hook failed [event=" + e + ", hook=" + tup.right + "].", t); + log.warning("Hook failed", "event", e, "hook", tup.right, t); } } } diff --git a/src/java/com/samskivert/util/FileUtil.java b/src/java/com/samskivert/util/FileUtil.java index 038143e9..2dfc89f0 100644 --- a/src/java/com/samskivert/util/FileUtil.java +++ b/src/java/com/samskivert/util/FileUtil.java @@ -90,8 +90,7 @@ public class FileUtil // entries that allow us to create our directories first if (entry.isDirectory()) { if (!efile.exists() && !efile.mkdir()) { - log.warning("Failed to create jar entry path [jar=" + jar + - ", entry=" + entry + "]."); + log.warning("Failed to create jar entry path", "jar", jar, "entry", entry); } continue; } @@ -100,8 +99,7 @@ public class FileUtil // prior to getting down and funky File parent = new File(efile.getParent()); if (!parent.exists() && !parent.mkdirs()) { - log.warning("Failed to create jar entry parent [jar=" + jar + - ", parent=" + parent + "]."); + log.warning("Failed to create jar entry parent", "jar", jar, "parent", parent); continue; } @@ -112,8 +110,7 @@ public class FileUtil jin = jar.getInputStream(entry); IOUtils.copy(jin, fout); } catch (Exception e) { - log.warning("Failure unpacking [jar=" + jar + - ", entry=" + efile + ", error=" + e + "]."); + log.warning("Failure unpacking", "jar", jar, "entry", efile, "error", e); failure = true; } finally { StreamUtil.close(jin); @@ -124,8 +121,7 @@ public class FileUtil try { jar.close(); } catch (Exception e) { - log.warning("Failed to close jar file [jar=" + jar + - ", error=" + e + "]."); + log.warning("Failed to close jar file", "jar", jar, "error", e); } return !failure; diff --git a/src/java/com/samskivert/util/Interval.java b/src/java/com/samskivert/util/Interval.java index fdb7be89..4bbb7b71 100644 --- a/src/java/com/samskivert/util/Interval.java +++ b/src/java/com/samskivert/util/Interval.java @@ -275,8 +275,8 @@ public abstract class Interval try { ival._runQueue.postRunnable(_runner); } catch (Exception e) { - log.warning("Failed to execute interval on run-queue " + - "[queue=" + ival._runQueue + ", interval=" + ival + "].", e); + log.warning("Failed to execute interval on run-queue", "queue", ival._runQueue, + "interval", ival, e); } } } diff --git a/src/java/com/samskivert/util/Invoker.java b/src/java/com/samskivert/util/Invoker.java index e0e31f03..f90fad85 100644 --- a/src/java/com/samskivert/util/Invoker.java +++ b/src/java/com/samskivert/util/Invoker.java @@ -200,7 +200,7 @@ public class Invoker extends LoopingThread didInvokeUnit(unit, start); } catch (Throwable t) { - log.warning("Invocation unit failed [unit=" + unit + "].", t); + log.warning("Invocation unit failed", "unit", unit, t); } } diff --git a/src/java/com/samskivert/util/PrefsConfig.java b/src/java/com/samskivert/util/PrefsConfig.java index c6d5c5ba..a6d030b5 100644 --- a/src/java/com/samskivert/util/PrefsConfig.java +++ b/src/java/com/samskivert/util/PrefsConfig.java @@ -55,7 +55,7 @@ public class PrefsConfig extends Config _prefs = Preferences.userRoot().node(path); } catch (AccessControlException ace) { // security manager won't let us access prefs, no problem! - log.info("Can't access preferences [path=" + path + "]."); + log.info("Can't access preferences", "path", path); _prefs = new NullPreferences(); } } @@ -72,7 +72,7 @@ public class PrefsConfig extends Config _prefs = Preferences.userRoot().node(path); } catch (AccessControlException ace) { // security manager won't let us access prefs, no problem! - log.info("Can't access preferences [path=" + path + "]."); + log.info("Can't access preferences", "path", path); _prefs = new NullPreferences(); } } @@ -279,7 +279,7 @@ public class PrefsConfig extends Config keys.add(key); } } catch (BackingStoreException bse) { - log.warning("Unable to enumerate preferences keys [error=" + bse + "]."); + log.warning("Unable to enumerate preferences keys", "error", bse); } } diff --git a/src/java/com/samskivert/util/RunAnywhere.java b/src/java/com/samskivert/util/RunAnywhere.java index 0d6068bc..4dc2e4b1 100644 --- a/src/java/com/samskivert/util/RunAnywhere.java +++ b/src/java/com/samskivert/util/RunAnywhere.java @@ -72,9 +72,8 @@ public class RunAnywhere if (stamp < _lastStamp) { // only warn once per time anomaly if (stamp > _lastWarning) { - log.warning("Someone call Einstein! The clock is " + - "running backwards [dt=" + - (stamp - _lastStamp) + "]."); + log.warning("Someone call Einstein! The clock is running backwards", + "dt", (stamp - _lastStamp)); _lastWarning = _lastStamp; } stamp = _lastStamp; diff --git a/src/java/com/samskivert/velocity/DispatcherServlet.java b/src/java/com/samskivert/velocity/DispatcherServlet.java index cc6c2742..6383b324 100644 --- a/src/java/com/samskivert/velocity/DispatcherServlet.java +++ b/src/java/com/samskivert/velocity/DispatcherServlet.java @@ -422,7 +422,7 @@ public class DispatcherServlet extends HttpServlet public Object methodException (Class clazz, String method, Exception e) throws Exception { - log.warning("Exception [class=" + clazz.getName() + ", method=" + method + "].", e); + log.warning("Exception", "class", clazz.getName(), "method", method, e); return ""; } @@ -458,7 +458,7 @@ public class DispatcherServlet extends HttpServlet } } catch (Exception e) { - log.warning("doRequest failed [uri=" + request.getRequestURI() + "].", e); + log.warning("doRequest failed", "uri", request.getRequestURI(), e); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage()); } } @@ -514,7 +514,7 @@ public class DispatcherServlet extends HttpServlet // identifier path = siteId + ":" + path; } - // log.info("Loading template [path=" + path + "]."); + // log.info("Loading template", "path", path); return RuntimeSingleton.getTemplate(path); } @@ -545,8 +545,8 @@ public class DispatcherServlet extends HttpServlet } catch (IOException ioe) { // the client probably crashed or aborted the connection ungracefully, so use log.info - log.info("Failed to write response [uri=" + context.getRequest().getRequestURI() + - ", error=" + ioe + "]"); + log.info("Failed to write response", "uri", context.getRequest().getRequestURI(), + "error", ioe); } finally { if (vw != null) { @@ -587,8 +587,8 @@ public class DispatcherServlet extends HttpServlet // nothing interesting to report } catch (Throwable t) { - log.warning("Unable to instantiate logic for application [path=" + path + - ", lclass=" + lclass + "].", t); + log.warning("Unable to instantiate logic for application", "path", path, + "lclass", lclass, t); } // if something failed, use a dummy in it's place so that we don't sit around all day diff --git a/src/java/com/samskivert/velocity/SiteJarResourceLoader.java b/src/java/com/samskivert/velocity/SiteJarResourceLoader.java index bb449885..681aa7b1 100644 --- a/src/java/com/samskivert/velocity/SiteJarResourceLoader.java +++ b/src/java/com/samskivert/velocity/SiteJarResourceLoader.java @@ -114,9 +114,8 @@ public class SiteJarResourceLoader extends ResourceLoader return (resource.getLastModified() < _loader.getLastModified(skey.siteId)); } catch (IOException ioe) { - Log.log.warning("Failure obtaining last modified time of " + - "site-specific jar file [siteId=" + skey.siteId + - ", error=" + ioe + "]."); + Log.log.warning("Failure obtaining last modified time of site-specific jar file", + "siteId", skey.siteId, "error", ioe); return false; } } @@ -144,9 +143,8 @@ public class SiteJarResourceLoader extends ResourceLoader try { return _loader.getLastModified(skey.siteId); } catch (IOException ioe) { - Log.log.warning("Failure obtaining last modified time of " + - "site-specific jar file [siteId=" + skey.siteId + - ", error=" + ioe + "]."); + Log.log.warning("Failure obtaining last modified time of site-specific jar file", + "siteId", skey.siteId, "error", ioe); return 0; } } diff --git a/src/java/com/samskivert/velocity/SiteKey.java b/src/java/com/samskivert/velocity/SiteKey.java index 40bb447c..b752dbcd 100644 --- a/src/java/com/samskivert/velocity/SiteKey.java +++ b/src/java/com/samskivert/velocity/SiteKey.java @@ -43,7 +43,7 @@ public class SiteKey try { siteId = Integer.parseInt(path.substring(0, cidx)); } catch (Exception e) { - log.warning("Invalid site path [path=" + path + "]."); + log.warning("Invalid site path", "path", path); } this.path = path.substring(cidx+1); } diff --git a/src/java/com/samskivert/xml/SimpleParser.java b/src/java/com/samskivert/xml/SimpleParser.java index 63ad3303..eef5d4a0 100644 --- a/src/java/com/samskivert/xml/SimpleParser.java +++ b/src/java/com/samskivert/xml/SimpleParser.java @@ -119,7 +119,7 @@ public class SimpleParser extends DefaultHandler try { return (val == null) ? -1 : Integer.parseInt(val); } catch (NumberFormatException nfe) { - log.warning("Malformed integer value [val=" + val + "]."); + log.warning("Malformed integer value", "val", val); return -1; } }