[slf4j-dev] svn commit: r1225 - slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/instrumentation
ravn at slf4j.org
ravn at slf4j.org
Mon Nov 10 01:42:10 CET 2008
Author: ravn
Date: Mon Nov 10 01:42:10 2008
New Revision: 1225
Modified:
slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/instrumentation/LogTransformer.java
Log:
added warning message if javassist is not on classpath (fails silently otherwise)
Modified: slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/instrumentation/LogTransformer.java
==============================================================================
--- slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/instrumentation/LogTransformer.java (original)
+++ slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/instrumentation/LogTransformer.java Mon Nov 10 01:42:10 2008
@@ -34,8 +34,7 @@
* Builder provides a flexible way of configuring some of many options on the
* parent class instead of providing many constructors.
*
- * {@link http
- * ://rwhansen.blogspot.com/2007/07/theres-builder-pattern-that-joshua.html}
+ * {@link http://rwhansen.blogspot.com/2007/07/theres-builder-pattern-that-joshua.html}
*
*/
public static class Builder {
@@ -118,6 +117,15 @@
private String levelEnabled;
private LogTransformer(Builder builder) {
+ String s = "WARNING: javassist not available on classpath for javaagent, log statements will not be added";
+ try {
+ if (Class.forName("javassist.ClassPool") == null) {
+ System.err.println(s);
+ }
+ } catch (ClassNotFoundException e) {
+ System.err.println(s);
+ }
+
this.addEntryExit = builder.addEntryExit;
// this.addVariableAssignment = builder.addVariableAssignment;
this.verbose = builder.verbose;
@@ -212,8 +220,7 @@
b = cl.toBytecode();
}
} catch (Exception e) {
- String pattern = "Could not instrument {}, exception : {}";
- System.err.println(format(pattern, name, e.getMessage()));
+ System.err.println("Could not instrument " + name + ", " + e);
e.printStackTrace(System.err);
} finally {
if (cl != null) {
More information about the slf4j-dev
mailing list