Rails 3.1 Logger and Log4r

What are the main differences between the Rails 3 logger and Log4r? It seems to me that the Rails 3 registrar provides you with everything you need.

+4
source share
1 answer

The built-in recorder is good enough for a development or production environment. especially at the very initial stages of your project, you do not need to spend time testing and choosing the right tool or library for working with the magazine. You can focus on the project itself. a similar situation like "erb" or "haml", "sass" or "less", "coffeescript" or "plain javascript", etc.

Log4r makes it easy to format logs using a configuration file. Its a good built-in alternator when you really need it.

http://log4r.rubyforge.org/

What is Log4r

Log4r is a comprehensive and flexible registration library written in Ruby for use in Ruby programs. It has a hierarchical logging system for any number of levels, user level names, log inheritance, multiple output destinations, execution tracing, user formatting, safteyness, XML and YAML stream, and much more. Log4r is a proponent of the philosophy of journaling using simple print statements. What is Log4r addition to this philosophy - a flexible way to manage information is logged. Information about the journal can be sent to any destination and with varying degrees of importance. Log4r is designed so that registration applications can remain in production code with almost no additional computational cost.

Log4r intends to be easy to use and configure, regardless of complexity. Random scripts can immediately use Log4r with minimal configurations, while more complex applications can configure a structured configuration file in XML or YAML. Comprehensive documentation is provided with a user manual, reference API, and over a dozen examples. Log4r tries to comply with the Least Surprise principle, which means that it works as intended at all points.

Log4r was inspired and provides many of the features of Apache Log4j, but is not a direct implementation or clone. Besides the superficial similarities, the projects are in no way connected and the code base is completely different. Log4r was developed without looking at the Apache Log4j code.

Log4r is an open source project and intends to remain so. The Log4r license is similar to the Ruby Language license. It is located on this page and in the distribution in a file named LICENSE.

+9
source

Source: https://habr.com/ru/post/1386611/


All Articles