Problem with log4r

hello

I am writing an article about logging with Python and I also want to mention
Ruby and log4r.

at the end of this posting you see the error message I get with Ruby 1.8.0
preview 2 and log4r 1.0.2. I also get this problems with Ruby 1.6.8

I used the example from the documentation:

···

===============
require 'log4r’
include Log4r

create a logger named ‘mylog’ that logs to stdout

mylog = Logger.new 'mylog’
mylog.outputters = Outputter.stdout

Now we can log.

def do_log(log)
log.debug "This is a message with level DEBUG"
log.info "This is a message with level INFO"
log.warn "This is a message with level WARN"
log.error "This is a message with level ERROR"
log.fatal "This is a message with level FATAL"
end
do_log(mylog)

does anybody know if there is a fix to this ??
is the log4r project still active ??

it would be bad to write an article if the software doesn’t work out of the
box. this could make a bad impression to the reader.
and I want Ruby to make a good impression !!!

and because it will be only a short part of the article about Ruby I can not
write about a workaround for this.

as an alternative I was thinking about using the devel/logger library
instead. but because log4r is more powerful and more similar to the python
stuff, I think this would be better to demonstrate.

any hints on this problem ?

Markus

here is the error message:

/usr/local/lib/ruby/1.8/singleton.rb:145: warning: redefine instance
/usr/local/lib/ruby/1.8/singleton.rb:145: warning: redefine instance
(eval):2: warning: redefine debug
(eval):1: warning: redefine debug?
(eval):2: warning: redefine info
(eval):1: warning: redefine info?
(eval):2: warning: redefine warn
(eval):1: warning: redefine warn?
(eval):2: warning: redefine error
(eval):1: warning: redefine error?
(eval):2: warning: redefine fatal
(eval):1: warning: redefine fatal?
(eval):1: warning: redefine all?
(eval):1: warning: redefine off?
(eval):1: warning: redefine debug
(eval):1: warning: redefine debug?
(eval):1: warning: redefine info
(eval):1: warning: redefine info?
(eval):1: warning: redefine warn
(eval):1: warning: redefine warn?
(eval):1: warning: redefine error
(eval):1: warning: redefine error?
(eval):1: warning: redefine fatal
(eval):1: warning: redefine fatal?
(eval):1: warning: redefine all?
(eval):1: warning: redefine off?
(eval):2: warning: redefine debug
(eval):1: warning: redefine debug?
(eval):2: warning: redefine info
(eval):1: warning: redefine info?
(eval):2: warning: redefine warn
(eval):1: warning: redefine warn?
(eval):2: warning: redefine error
(eval):1: warning: redefine error?
(eval):2: warning: redefine fatal
(eval):1: warning: redefine fatal?
(eval):1: warning: redefine all?
(eval):1: warning: redefine off?
(eval):2: warning: redefine debug
(eval):2: warning: redefine info
(eval):2: warning: redefine warn
(eval):2: warning: redefine error
(eval):2: warning: redefine fatal
/usr/local/lib/ruby/site_ruby/1.8/log4r/formatter/formatter.rb:58:in
sprintf': unnumbered(1) mixed with numbered (ArgumentError) from /usr/local/lib/ruby/site_ruby/1.8/log4r/formatter/formatter.rb:58:informat’
from
/usr/local/lib/ruby/site_ruby/1.8/log4r/outputter/outputter.rb:118:in
format' from /usr/local/lib/ruby/site_ruby/1.8/log4r/outputter/outputter.rb:108:incanonical_log’
from
/usr/local/lib/ruby/site_ruby/1.8/log4r/outputter/outputter.rb:108:in
synch' from /usr/local/lib/ruby/site_ruby/1.8/log4r/outputter/outputter.rb:128:insynchronize’
from
/usr/local/lib/ruby/site_ruby/1.8/log4r/outputter/outputter.rb:128:in
synch' from /usr/local/lib/ruby/site_ruby/1.8/log4r/outputter/outputter.rb:108:incanonical_log’
from (eval):3:in debug' from (eval):8:indebug’
from (eval):8:in each' from (eval):8:indebug’
from simple.rb:22:in `do_log’
from simple.rb:28

probably the problem happens with ruby 1.8, I had that working with
1.6.7 on linux 2.4.
1.8 is still non stabel, so you could safely tell to your readers it
works with the standard distribution.

Anyway, is log4r supposed to work on windows?
Iit seems there is an open bug with the same example since a looong
time.
If it does’nt works, why putting it in the PragProg installer?

···

il Mon, 10 Mar 2003 22:42:54 +0100, Markus Jais info@mjais.de ha scritto::

hello

I am writing an article about logging with Python and I also want to mention
Ruby and log4r.

Markus Jais info@mjais.de writes:

does anybody know if there is a fix to this ??

I posted a patch: http://sourceforge.net/tracker/?group_id=43396&atid=436183

I also posted a simple syslog outputter class.

is the log4r project still active ??

As far as I can tell, it hasn’t been touched since August 2002.

Steve

gabriele renzi wrote:

il Mon, 10 Mar 2003 22:42:54 +0100, Markus Jais info@mjais.de ha
scritto::

hello

I am writing an article about logging with Python and I also want to
mention Ruby and log4r.

probably the problem happens with ruby 1.8, I had that working with
1.6.7 on linux 2.4.
1.8 is still non stabel, so you could safely tell to your readers it
works with the standard distribution.

the problem is there for 1.6.8, too
maybe the patch someone else posted can help. have not yet testet it.

Anyway, is log4r supposed to work on windows?
Iit seems there is an open bug with the same example since a looong
time.
If it does’nt works, why putting it in the PragProg installer?

If have not tested it on windows but I think it should work there.
it is pure ruby, no C. but I do not know it any Unix specific calls
are made.

markus

This is an important package. Does anyone have the inclination to
continue its maintanence, in consultation with the original author?

Gavin

···

On Tuesday, March 11, 2003, 12:29:10 PM, slumos wrote:

is the log4r project still active ??

As far as I can tell, it hasn’t been touched since August 2002.