Ruby Logger over Log4j

Hi all. I recently wrote some code for using Log4j as your Ruby
logger. I pushed it up to github as a project named log4jruby.

Log4jruby is a thin wrapper around the Log4j Logger. It is geared more
toward those who are using JRuby to integrate with and build on top of
Java code that uses Log4j. The Log4jruby::Logger provides an interface
much like the standard ruby Logger. Logging is configured via
traditional Log4j methods.

  • Filename, line number, and method name are made available(if
    tracing is on) to your appender layout via MDC.
  • Ruby and Java Exceptions(i.e NativeException) are logged with
    stack traces.
  • Logging config for your ruby code can be added to your existing
    configuration. Ruby logger names are mapped to dot separated names
    prefixed with.jruby

log4j.appender.Ruby=org.apache.log4j.ConsoleAppender
log4j.appender.Ruby.layout=org.apache.log4j.PatternLayout
log4j.appender.Ruby.layout.ConversionPattern=%5p %.50X{fileName}
%X{methodName}:%X{lineNumber} - %m%n

log4j.logger.jruby=info,Ruby
log4j.logger.jruby.MyModule.MyClass=debug

There’s not really much to the implementation but I thought other’s
might find it useful. Let me know(offline) if you think its worth me
publishing the gem.

Thanks,
-lenny