Created
November 16, 2010 01:42
-
-
Save jordansissel/701296 to your computer and use it in GitHub Desktop.
Using ruby minstrel to instrument java classes from jruby.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "java" | |
require "minstrel" | |
m = Minstrel::Instrument.new | |
# Wrap java.io.PrintStream | |
m.wrap(java.io.PrintStream) do |point, klass, method, *args| | |
puts "#{point} #{klass.name || klassname}##{method}(#{args.inspect})" | |
end | |
# Try it. | |
java.lang.System.out.println("Testing") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% jruby jruby-instrument-printstream.rb | |
enter Java::JavaIo::PrintStream#println(["Testing"]) | |
Testing | |
exit Java::JavaIo::PrintStream#println(["Testing"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment