I have to run some Ruby scripts using JRuby in an OSGi environment. In these Ruby scripts, I need to use Log4J, so I write something like:
require "C:\\path\log4j.jar"
# ....
ois = JRubyObjectInputStream.new(java.io.BufferedInputStream.new(socket.to_inputstream))
log4j_obj = ois.readObject
event["message"] = log4j_obj.getRenderedMessage
# ....
It works fine, but now I want to install Log4J in the OSGi environment and use it in the Ruby script. How can I do that?
I honestly don't know much about OSGi, but I would hope that the container would put libraries like Log4J onto the classpath. If that's the case, then you can simply:
require 'log4j.jar'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.