Class: LogStash::Inputs::Log4j::Log4jInputStream
- Inherits:
-
Object
- Object
- LogStash::Inputs::Log4j::Log4jInputStream
- Defined in:
- lib/logstash/inputs/log4j.rb
Constant Summary collapse
- ALLOWED_CLASSES =
["org.apache.log4j.spi.LoggingEvent"]
Instance Method Summary collapse
-
#initialize(*args) ⇒ Log4jInputStream
constructor
A new instance of Log4jInputStream.
- #resolveClass(desc) ⇒ Object
- #safety_check(name) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Log4jInputStream
Returns a new instance of Log4jInputStream.
264 265 266 267 |
# File 'lib/logstash/inputs/log4j.rb', line 264 def initialize(*args) super @class_loader = org.jruby.Ruby.getGlobalRuntime.getJRubyClassLoader end |
Instance Method Details
#resolveClass(desc) ⇒ Object
273 274 275 276 277 |
# File 'lib/logstash/inputs/log4j.rb', line 273 def resolveClass(desc) name = desc.getName safety_check(name) java.lang.Class.forName(name, false, @class_loader) end |
#safety_check(name) ⇒ Object
269 270 271 |
# File 'lib/logstash/inputs/log4j.rb', line 269 def safety_check(name) raise java.io.InvalidObjectException.new("Object type #{name} is not allowed.") if !ALLOWED_CLASSES.include?(name) end |