Logstash plugins do not display exception messages in `register` method.
- Dominant language
- Java
- Stars
- 14.9k
- Forks
- 3.5k
- Avg merge
- 19h 14m
- Merged PRs (30d)
- 63
Description
- Version: Logstash 2.4.0
- Operating System: CentOS Linux release 7.3.1611 (Core)
- Config File (if you have sensitive info, please remove it):
It can be any possible config file which would generate an error in the `register` method of a plugin. However here is one sample:
```
input {
http_poller {
urls=> { test1 => 1 }
interval => { cron => "* * * * * UTC"}
}
}
output {
stdout {
codec => rubydebug
}
}
```
- Steps to Reproduce:
Run any plugin with an incorrect config which would be tested in the `register` method of any plugin. The sample I provided above would test the `urls` in the `register` method of the `logstash-input-http_poller` plugin.
The exception generated will look like this:
```
Pipeline aborted due to error {:exception=>"LogStash::ConfigurationError", :backtrace=>["/opt/logstash-2.4.0/vendor/bundle/jruby/1.9/gems/logstash-input-http_poller-2.0.6/lib/logstash/inputs/http_poller.rb:108:in `normalize_request'",
"/opt/logstash-2.4.0/vendor/bundle/jruby/1.9/gems/logstash-input-http_poller-2.0.6/lib/logstash/inputs/http_poller.rb:88:in `setup_requests!'",
"org/jruby/RubyHash.java:1342:in `each'",
"org/jruby/RubyEnumerable.java:757:in `map'",
"/opt/logstash-2.4.0/vendor/bundle/jruby/1.9/gems/logstash-input-http_poller-2.0.6/lib/logstash/inputs/http_poller.rb:88:in `setup_requests!'",
"/opt/logstash-2.4.0/vendor/bundle/jruby/1.9/gems/logstash-input-http_poller-2.0.6/lib/logstash/inputs/http_poller.rb:79:in `register'",
"/opt/logstash-2.4.0/vendor/bundle/jruby/1.9/gems/logstash-core-2.4.0-java/lib/logstash/pipeline.rb:330:in `start_inputs'",
"org/jruby/RubyArray.java:1613:in `each'",
"/opt/logstash-2.4.0/vendor/bundle/jruby/1.9/gems/logstash-core-2.4.0-java/lib/logstash/pipeline.rb:329:in `start_inputs'",
"/opt/logstash-2.4.0/vendor/bundle/jruby/1.9/gems/logstash-core-2.4.0-java/lib/logstash/pipeline.rb:180:in `start_workers'",
"/opt/logstash-2.4.0/vendor/bundle/jruby/1.9/gems/logstash-core-2.4.0-java/lib/logstash/pipeline.rb:136:in `run'",
"/opt/logstash-2.4.0/vendor/bundle/jruby/1.9/gems/logstash-core-2.4.0-java/lib/logstash/agent.rb
```
However, based on [line 108](https://github.com/logstash-plugins/logstash-input-http_poller/blob/v2.0.6/lib/logstash/inputs/http_poller.rb#L108) (relevant section below), there should also be a message regarding the actual configuration error.
```
else
raise LogStash::ConfigurationError, "Invalid URL or request spec: '#{url_or_spec}', expected a String or Hash!"
end
```
I've run into this issue when working on my own plugin and I am relying on the exception messages to inform users how to rectify configuration issues. Is there an issue with logstash-core which is suppressing the exception message?
Contributor guide
Assessment
This issue has not been assessed yet.