Questions tagged [log4r]

Log4r is a logging library for Ruby akin to Log4j for those coming from Java.

Log4r is a comprehensive and flexible logging library written in Ruby for use in Ruby programs. It features a hierarchical logging system of any number of levels, custom level names, logger inheritance, multiple output destinations, execution tracing, custom formatting, thread safteyness, XML and YAML configuration, and more. Log4r is an adherent to the philosophy of logging using simple print statements. What Log4r adds to this philosophy is a flexible way of controling the information being logged. Log information can be sent to any kind of destination and with varying degrees of importance. Log4r is designed so that logging statements can remain in production code with almost no extra computational cost.

Log4r intends to be easy to use and configure, no matter the complexity. Casual scripts can use Log4r right away with minimal configuration, while more sophisticated applications can set up a structured configuration file in XML or YAML. Comprehensive documentation is provided, with a user's manual, a reference API, and over a dozen examples. Log4r attempts to abide by the Principle of Least Surprise, which means that it works as intended at all points.

Log4r was inspired by and provides much of the features of the Apache Log4j project, but is not a direct implementation or clone. Aside from superficial similarities, the projects are not related in any way and the code base is completely distinct. Log4r was developed without even looking at the Apache Log4j code.

Log4r is an Open Source project and intends to remain that way. The Log4r license is similar to the Ruby Language license.

57 questions
0
votes
1 answer

ArgumentError: wrong number of arguments (2 for 1) for 'initialize'?

Fairly new to ruby, playing with Mini Test and log4r, trying to write a wrapper class. Getting the following error: $ ruby logger.rb Run options: --seed 4605 # Running tests: E Finished tests in 0.000000s, Inf tests/s, NaN assertions/s. 1)…
jbobbylopez
  • 257
  • 2
  • 6
  • 15
0
votes
2 answers

Getting error using log4r with delayed job

I have a working Rails 3.2 app (Ruby 1.9.2p290 on Windows Server 2008 R2) which uses delayed job for several background jobs. I recently replaced Rails default logging with log4r and it's working fine for the Rails app. However, when I start up…
Edward J. Stembler
  • 1,932
  • 4
  • 30
  • 53
0
votes
1 answer

Log4r configurator throws exception instantiating EmailOutputter

I'm setting up Log4r using an XML configuration file, and I can't get the EmailOutputter to work correctly. Here's my outputter tag:
Brad Urani
  • 1,429
  • 1
  • 16
  • 29
0
votes
1 answer

How can I define my own levels in log4r without a conflict with other log4r-loggers?

I can define my own log-levels with log4r: require 'log4r' require 'log4r/configurator' # This is how we specify our levels Log4r::Configurator.custom_levels "Foo", "Bar", "Baz" log = Log4r::Logger.new('custom levels') p log.levels #-> ["ALL",…
knut
  • 27,320
  • 6
  • 84
  • 112
0
votes
1 answer

Rails 4 log level resets to Debug, even in production

when I upgraded to Rails 4 my log level is always at DEBUG, even though I have config.logger.level = Logger::WARN in my production.rb It was working fine previously on Rails 3.2, any ideas where might have changed?
Daniel
  • 253
  • 1
  • 4
  • 10
0
votes
1 answer

how do I use Ruby log4r colorize to print colored text at stdout and non-colored text to a file

I use log4r-color as logger. It works great by putting colored text at stdout (console), till I tee the console output to a file. (ruby myApp | tee console.log). I have two questions: How do I use log4r to print colored message at STDOUT and at the…
user2562153
  • 317
  • 1
  • 3
  • 12
0
votes
3 answers

Getting all classes defined under a module

I have several files defining nested modules, say: File1: module A module B class B1 class B1Error < Exception ; end end end end File 2: module A module B class B2 class B2Error < Exception ; end class B2_inner …
user2562153
  • 317
  • 1
  • 3
  • 12
0
votes
1 answer

Log4r - output is unordered

I'm a newbie in Rails, and I had a problem with my Rails project. I used Log4r for my logger. I also used config for Log4r at How to configure Log4r with Rails 3.0.x? . But when I send some request at the same time, the output of Log4r has error. It…
TidusLe
  • 41
  • 1
  • 7
0
votes
1 answer

Why should i use Rails.logger instead of logger in my model class

I am a newbie to rails. I am using log4r for logging. I observed that when i use just logger in my models, it doesn't work. But if i use Rails.logger the logs are coming fine. Why is it happening? Please help me to understand. def…
Anirudhan J
  • 2,072
  • 6
  • 27
  • 45
0
votes
1 answer

R: data frame view in log file

I created a log file for saving a data frame using log4r package. The code i used is as follows: library('log4r') logger <- create.logger(logfile = "abc.log", level = log4r:::DEBUG) values <-…
Dinoop Nair
  • 2,663
  • 6
  • 31
  • 51
0
votes
1 answer

How to configure log4r 1.1.10 with rails 3.2.13 and ruby 2.0.0 p0

I am a newbie to Ruby On Rails and i am struck with configuring logging for the application which i am developing I followed the steps answered in this question a link In my log directory, the log file gets created. But nothing gets written to the…
Anirudhan J
  • 2,072
  • 6
  • 27
  • 45
-1
votes
0 answers

internal Rails 3 Logger - can I use this to get a separate log file output that doesn't include asset GETs?

re the internal Rails 3 Logger - can I use this to get a separate log file output that doesn't include asset GETs? So then I can tail this file and only see my own debugging entries... That is, or do I need to set up log4r to achieve this?
Greg
  • 34,042
  • 79
  • 253
  • 454
1 2 3
4