Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 816441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:49:56+00:00 2026-05-15T01:49:56+00:00

I’m pretty new to ruby environments and I was looking for a nice logging

  • 0

I’m pretty new to ruby environments and I was looking for a nice logging framework to use it my ruby and rails applications.

In my previous experiences I have successfully used log4j and log4p (the perl port) and was expecting the same level of usability (and maturity) with log4r.

However I must say that there are a number of things that are not clear at all in the log4r framework.

1 Logger Inheritance

The logger inheritance does not seem to be managed at all !

If I declare a logger named ‘myapp’ and then try to get a logger name ‘myapp::engine’, the lookup will end with a NameError.

I would expect that the framework returns the root logger according to the naming scheme and to use the ‘myapp’ logger.

Q1 : Of course I can work around this and manage the names by myself with a lookup method, however is there a cleaner way to do this without any extra coding ?

2 YAML configuration

Second thing that confuses me is the yaml configuration. On the log4r site there are literally no information about this system, the doc links forward to missing pages, so all the info I can find about is contained in the examples directory of the gem.

I was pretty confused with the fact that the yaml configuration must contain the pre_config section, and that I need to define my own levels.

If I remove the pre_config secion, or replace all the “custom” levels by the standard ones ( debug, info, warn, fatal ) , the example will throw the following error :

log4r/yamlconfigurator.rb:68:in `decode_yaml': Log level must be in 0..7 (ArgumentError)

So there seems to be no way of using a simple file where we only declare the loggers and appenders for the framework.

Q2 : I realy think that I missed something and that must be a way of providing a simple yaml conf file. Do you have any examples of such an usage ?

3 Variables substitution in XML file

Q3 : The Yaml configuration system seems to provide such a feature however I was unable to find a similar feature with XML files. Any ideas ?

4 Alternatives ?

I must say that I’m very disappointed by the feature level and the maturity of log4r compared to the log4j and other log4j ports.

I run into this framework with a solid background of logging APIs in other languages and find myself working around in all kinds just to make ‘basic things’ running in a “real world application”.

By that I mean a complex application composed of several gems, console/scripting apps, and a rails web front end where the configuration must be mutualized and where we make intensive usage of namespaces and inheritance.

I’ve run several searches in order to find something more suitable or mature, but did not find anything similar.

Q4 : Do you guys know any (serious) alternatives to log4r framework that could be used in a enterprise class app ?

Thanks reading all of this !

I’d really appreciate any pointers,

Kind Regards,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T01:49:57+00:00Added an answer on May 15, 2026 at 1:49 am

    I agree that the log4r documentation is pretty poor. We are using it though and it serves us pretty well, in let’s-say an enterprisey app.

    We are not using logger inheritance so I can’t help you with it, and also I don’t know about any alternative software, but:

    Here’s the code we use to read YAML configuration (in fact, I think we pass it as already loaded into a Hash), it also supports variable substitution:

    require 'log4r'
    require 'log4r/yamlconfigurator'
    
    y = "log4r_config:
    
      # define all loggers ...
      loggers:
        - name      : production
          level     : INFO
          trace     : 'false'
          outputters:
            - stdout
    
      # define all outputters (incl. formatters)      
      outputters:
        - type     : StdoutOutputter
          name     : stdout
          formatter:
            date_pattern: '%Y-%m-%d %H:%M:%S'
            pattern     : '%d %l: #\{TEST\} %m '
            type        : PatternFormatter"
    
    h = YAML.load y
    log_cfg = YamlConfigurator
    log_cfg['TEST'] = 'foobar'
    log_cfg.decode_yaml h['log4r_config']
    @log = Logger['production']
    @log.info 'test'
    #=>2010-05-20 14:36:32 INFO: foobar test 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 442k
  • Answers 442k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer @Echo Off SETLOCAL EnableDelayedExpansion SET LIST=cmd cmd FOR %%G IN… May 15, 2026 at 5:55 pm
  • Editorial Team
    Editorial Team added an answer Try adding the drop = FALSE option: R> df[-(length(df[,1])), ,… May 15, 2026 at 5:55 pm
  • Editorial Team
    Editorial Team added an answer It's the multipart/form-data encoding which is described in RFC 1867… May 15, 2026 at 5:55 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.