Ruby on Rails development from scratch (Windows) (35)-Logs (log)

Source: Internet
Author: User
Tags command line log ruby on rails

Rails built log functionality, or more precisely, rails exposes the Logger object, which can be used in all rails programs.

Logger is a simple log frame ported from Ruby (you can type RI logger to view the documentation of the standard library in Ruby's command line), and for us, we just need to know that logger can target warnning,info, Error or fatal level to generate log information, and then determine which levels of log information is written to the log file.

Logger.warn ("I don ' t ' idea", "a good idea")

Logger.info ("Dave's trying to doing something bad")

Logger.error ("Now he" gone and broken It)

Logger.fatal ("I Give Up")

In a rails program, log information is written to the log folder file, which file, depending on your current program's environment configuration, if the development environment, then log information will be written to the log\ Development.log file, corresponding to the test environment, log files for the log\test.log,production environment, log files for Log\production.log

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.