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

Ceki Gulcu listid at qos.ch
Mon Oct 27 22:49:49 CET 2008


Hello

You can see the latest Continuum build results for SLF4J and logback at

   http://continuum.qos.ch/

You can register a new user (which is complicated because most of the links need 
to be massaged) or alternatively login as "dev" with password "dev" + "1", where 
+ stands for append.


ravn at slf4j.org wrote:
> 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();
> _______________________________________________
> dev mailing list
> dev at slf4j.org
> http://www.slf4j.org/mailman/listinfo/dev

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch



More information about the slf4j-dev mailing list