Problem using logging gem (0.9.4) in JRuby 1.1.4


#1

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:inattach_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:inrequire’
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:inrequire’
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:inrequire’
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

#2

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


#3

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?