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

ravn at slf4j.org ravn at slf4j.org
Mon Oct 27 22:36:15 CET 2008


Author: ravn
Date: Mon Oct 27 22:36:15 2008
New Revision: 1219

Modified:
   slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/agent/package.html
   slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/instrumentation/JavassistHelper.java

Log:
added javadoc

Modified: slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/agent/package.html
==============================================================================
--- slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/agent/package.html	(original)
+++ slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/agent/package.html	Mon Oct 27 22:36:15 2008
@@ -12,9 +12,22 @@
 agents in Java, which previously was possible in native code only. The
 full details are available at <a
 	href="http://java.sun.com/javase/6/docs/api/java/lang/instrument/package-summary.html">http://java.sun.com/javase/6/docs/api/java/lang/instrument/package-summary.html</a>.
-Please notice that code made available to the java agent is also available to the actual program executed.
 
+
+Please notice that code made available to the java agent is also
+available to the actual program executed.</p>
+<p>The slf4j-ext-X.Y.Z.jar file provides such a java agent, which is
+implemented in AgentPremain.java.  It is used by adding a -javaagent flag to the Java command line:
+
+E.g.
+<pre><code>java HelloWorld</code></pre>
+is changed to
+<pre><code>java -javaagent:/path/to/slf4j-ext-X.Y.Z.jar=<em>OPTIONS</em> HelloWorld</code></pre>
+
+What is actually done, depends on the <em>OPTIONS</em> passed to the agent.  These are listed in AgentOptions.java.
 </p>
 
+
+
 </body>
 </html>

Modified: slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/instrumentation/JavassistHelper.java
==============================================================================
--- slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/instrumentation/JavassistHelper.java	(original)
+++ slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/instrumentation/JavassistHelper.java	Mon Oct 27 22:36:15 2008
@@ -5,6 +5,7 @@
 import javassist.CtMethod;
 import javassist.Modifier;
 import javassist.NotFoundException;
+import javassist.bytecode.AttributeInfo;
 import javassist.bytecode.CodeAttribute;
 import javassist.bytecode.LocalVariableAttribute;
 
@@ -73,10 +74,12 @@
     CodeAttribute codeAttribute = method.getMethodInfo().getCodeAttribute();
 
     LocalVariableAttribute locals = null;
+    
 
     if (codeAttribute != null) {
-      locals = (LocalVariableAttribute) codeAttribute
-          .getAttribute("LocalVariableTable");
+      AttributeInfo attribute;
+      attribute = codeAttribute.getAttribute("LocalVariableTable");
+      locals = (LocalVariableAttribute) attribute;
     }
 
     String methodName = method.getName();



More information about the slf4j-dev mailing list