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