[slf4j-dev] svn commit: r1264 - slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/instrumentation

ravn at slf4j.org ravn at slf4j.org
Sun Jan 11 14:11:01 CET 2009


Author: ravn
Date: Sun Jan 11 14:11:01 2009
New Revision: 1264

Modified:
   slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/instrumentation/ToStringHelper.java

Log:
Experimented with detecting recursive calls on the same object, but it
didn't work well.  Ended up adding recommendation to disable logging for
troublesome classes in the log backend configuration.


Modified: slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/instrumentation/ToStringHelper.java
==============================================================================
--- slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/instrumentation/ToStringHelper.java	(original)
+++ slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/instrumentation/ToStringHelper.java	Sun Jan 11 14:11:01 2009
@@ -42,13 +42,16 @@
 	 * don't have usable toString methods.
 	 * 
 	 * @param o
+	 *            incoming object to render.
 	 * @return
 	 */
+
 	public static String render(Object o) {
 		if (o == null) {
 			return String.valueOf(o);
 		}
 		Class<?> objectClass = o.getClass();
+
 		if (unrenderableClasses.containsKey(objectClass) == false) {
 			try {
 				if (objectClass.isArray()) {
@@ -58,12 +61,15 @@
 				}
 			} catch (Exception e) {
 				Long now = new Long(System.currentTimeMillis());
+
 				System.err.println("Disabling exception throwing class "
 						+ objectClass.getName() + ", " + e.getMessage());
+
 				unrenderableClasses.put(objectClass, now);
 			}
 		}
-		return o.getClass().getName() + "@" + Integer.toHexString(o.hashCode());
+		String name = o.getClass().getName();
+		return name + "@" + Integer.toHexString(o.hashCode());
 	}
 
 	/**



More information about the slf4j-dev mailing list