Ruby on rails Development (windows) (35)-Log)

Source: Internet
Author: User
Rails has a built-in Log function, or, more accurately, Rails exposes the Logger object, which can be used in all Rails programs.

Logger is a simple Log framework transplanted from ruby (you can type ri Logger in the ruby command line to view the documentation of the standard library). For us, we only need to know the level of Log information that Logger can generate for warnning, info, error or fatal level, and then determine the level of Log information written to the Log file.

Logger. warn ("I don't think that's a good idea ")

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

Logger. error ("Now he's gone and broken it ")

Logger. fatal ("I give up ")

 

In a Rails program, Log information is written to the file in the Log folder. The specific file depends on the environment configuration of your current program. If it is in the development environment, log information will be written to log \ development. the log file corresponds to the log \ test in the test environment. in log and production environments, the log file is 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.