Last active
August 29, 2015 14:04
-
-
Save thedebugger/357446cfa0d716b0653c to your computer and use it in GitHub Desktop.
jruby crying over
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
module ActiveSupport | |
class Logger < ::Logger <===== this line is raising this error | |
end | |
end | |
TypeError: superclass must be a Class (#<Class:Java::OrgSlf4j::Logger> given) | |
/Users/svij/.rvm/gems/jruby-1.7.13@penchant/gems/activesupport-4.1.4/lib/active_support/logger.rb:6:in `ActiveSupport' | |
/Users/svij/.rvm/gems/jruby-1.7.13@penchant/gems/activesupport-4.1.4/lib/active_support/logger.rb:5:in `(root)' | |
/Users/svij/.rvm/gems/jruby-1.7.13@penchant/gems/activesupport-4.1.4/lib/active_support.rb:1:in `(root)' | |
/Users/svij/.rvm/gems/jruby-1.7.13@penchant/gems/activesupport-4.1.4/lib/active_support.rb:27:in `(root)' | |
/Users/svij/.rvm/gems/jruby-1.7.13@penchant/gems/activesupport-4.1.4/lib/active_support/time.rb:1:in `(root)' | |
I've reopened Java::OrgSlf4j::Logger like this: | |
module Java::OrgSlf4j::Logger | |
[:error, :warn, :info, :debug].each do |level| | |
define_method ("#{level}_ex".to_sym) do |exception_or_message, entity, id, params = nil| | |
hash_msg = {:entity => entity, :id => id} | |
if exception_or_message.is_a?(Exception) | |
exception = exception_or_message | |
backtrace = exception.backtrace | |
hash_msg[:error] = {:class => exception.class.name, :backtrace => backtrace} | |
hash_msg[:message] = exception.message | |
else | |
hash_msg[:message] = exception_or_message.to_s | |
end | |
hash_msg[:params] = params unless params.nil? | |
self.send(level, hash_msg.to_s) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment