Forum: JRuby Problem using logging gem (0.9.4) in JRuby 1.1.4

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Schultz, Darcy L. (Guest)
on 2008-10-16 22:48
(Received via mailing list)
Here's the code:

  require 'rubygems'
  gem 'logging'

  require 'logging'
  require 'logging/appenders/rolling_file'
  require 'logging/layouts/pattern'

  logger = Logging::Logger['default']
  logger.additive = false
  logger.trace = true
  layout = Logging::Layouts::Pattern.new(:pattern => "[%l] %d :: %m\n" )
  appender = Logging::Appenders::RollingFile.new("d:/logging_test.log",
    :size => 102400, :keep => 5, :layout => layout )
  logger.add_appenders(appender)

  logger.debug("hello")

Works okay in JRuby 1.1.3 and MRI Ruby but doesn't work in JRuby 1.1.4.
Here's the stack trace:

$ jruby logging_test.rb
D:/NetBeans/ruby2/jruby-1.1.4/lib/ruby/site_ruby/1.8/ffi/ffi.rb:328:in
`create_invoker': Function 'open' not found! (Looking in 'msvcrt' or
this process) (FFI::NotFoundError)
        from
D:/NetBeans/ruby2/jruby-1.1.4/lib/ruby/site_ruby/1.8/ffi/ffi.rb:380:in
`attach_function'
        from D:/NetBeans/ruby2/jruby-1.1.4/lib/ruby/1.8/syslog.rb:28
        from D:/NetBeans/ruby2/jruby-1.1.4/lib/ruby/1.8/syslog.rb:27:in
`require'
        from
D:/NetBeans/ruby2/jruby-1.1.4/lib/ruby/site_ruby/1.8/rubygems/custom_req
uire.rb:27:in `require'
        from
D:/NetBeans/ruby2/jruby-1.1.4/lib/ruby/gems/1.8/gems/logging-0.9.4/lib/l
ogging/appenders/syslog.rb:3
        from
D:/NetBeans/ruby2/jruby-1.1.4/lib/ruby/gems/1.8/gems/logging-0.9.4/lib/l
ogging/appenders/syslog.rb:27:in `require'
        from
D:/NetBeans/ruby2/jruby-1.1.4/lib/ruby/site_ruby/1.8/rubygems/custom_req
uire.rb:27:in `require'
        from
D:/NetBeans/ruby2/jruby-1.1.4/lib/ruby/gems/1.8/gems/logging-0.9.4/lib/l
ogging.rb:287:in `require_all_libs_relative_to'
         ... 9 levels...
        from
D:/NetBeans/ruby2/jruby-1.1.4/lib/ruby/gems/1.8/gems/logging-0.9.4/lib/l
ogging.rb:27:in `require'
        from
D:/NetBeans/ruby2/jruby-1.1.4/lib/ruby/site_ruby/1.8/rubygems/custom_req
uire.rb:27:in `require'
        from logging_test.rb:4

This email communication and any files transmitted with it may contain
confidential and or proprietary information and is provided for the use
of the intended recipient only.  Any review, retransmission or
dissemination of this information by anyone other than the intended
recipient is prohibited.  If you receive this email in error, please
contact the sender and delete this communication and any copies
immediately.  Thank you.
http://www.encana.com

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Jay McGaffigan (Guest)
on 2008-10-17 04:17
(Received via mailing list)
I encountered this problem.
It's already fixed on edge.

If you don't feel like building edge I believe you can update the ffi.rb
file in your distribution to get around this.  (that's what I did)
Basically some exceptions were renamed to fix this (wmeisner did the
fix)

Jay
Bahaw A. (Guest)
on 2009-02-02 15:23
Jay McGaffigan wrote:
> I encountered this problem.
> It's already fixed on edge.
>
> If you don't feel like building edge I believe you can update the ffi.rb
> file in your distribution to get around this.  (that's what I did)
> Basically some exceptions were renamed to fix this (wmeisner did the
> fix)
>
> Jay

I have the same problem. Are you suggesting to build Rails edge or use
latest Jruby?
This topic is locked and can not be replied to.