加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails-3 – Rails 3.1内置记录器与Log4r

发布时间:2020-12-17 03:45:46 所属栏目:百科 来源:网络整理
导读:Rails 3内置记录器和Log4r之间的主要区别是什么?在我看来,Rails 3记录器为您提供了所需的一切. 解决方法 内置记录器对于开发或生产环境都足够好.特别是在项目的最初阶段,您不需要浪费时间进行测试并选择合适的工具或库来执行记录器作业.您可以专注于项目本
Rails 3内置记录器和Log4r之间的主要区别是什么?在我看来,Rails 3记录器为您提供了所需的一切.

解决方法

内置记录器对于开发或生产环境都足够好.特别是在项目的最初阶段,您不需要浪费时间进行测试并选择合适的工具或库来执行记录器作业.您可以专注于项目本身.类似“erb”或“haml”,“sass”或“less”,“coffeescript”或“plain javascript”等类似情况……

Log4r允许您通过配置文件轻松格式化日志.当你真正需要它时,它是一个很好的内置记录仪交流发电机.

http://log4r.rubyforge.org/

What Log4r Is

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. It resides on this page and in the distribution in a file named LICENSE.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读