colinsurprenant / redstorm

JRuby on Storm
Other
298 stars 56 forks source link

Switch Logger To SLF4J #110

Closed arielvalentin closed 5 years ago

arielvalentin commented 10 years ago

Storm has moved to [SLF4J with logback|http://storm.incubator.apache.org/2013/12/08/storm090-released.html], however Redstorm uses the Log4J API. I would like to be able to use SLF4J API instead of any specific implementation in my topologies.

colinsurprenant commented 10 years ago

Absolutely, thanks for pointing that out.

arielvalentin commented 10 years ago

I have run into the Ruby Exceptions aren't Java Exceptions problem. Looks like @dekellum solved this by adding an adapter API in rjack-slf4j https://github.com/dekellum/rjack/blob/dev/slf4j/lib/rjack-slf4j.rb

Should we consider using this approach instead?

colinsurprenant commented 10 years ago

what is the Ruby Exceptions aren't Java Exceptions problem and how did it manifest?

arielvalentin commented 10 years ago

I hope these comments make sense. I am exhausted.

RubyException does not inherit from Throwable. I used the overloaded error method assuming it was matching error(string, throwable) but it actually resolved to error(string, object).

I then started thinking about what it would take to use the logger with gems. It was then I realized the APIs would not line up e.g. what if someone tried to use the block to delay interpretation of the log message. In this case we would need an object that conformed to the API of a Ruby Logger. That's what made me think of rjack. I did pose the question to the JRuby list and was directed at a few other gems but haven't really looked into them.

The differences in the Logger APIs made us converge on using the error(string) method and just generate the message using a helper function.