Ruby on Rails
logger

What is it?

Rails makes use of ruby’s standard logger, Log4r, or another logger that provides a similar interface can also be substituted if you wish.

A logger object is made available to each of ActiveRecord, ActionController and ActionMailer.

How to write to a logger

From within a controller, model or mailer:


  logger.info "Starting process fubar..."

See HowtoAccessTheLogFile for more examples.

Where are the log files?

By default Rails will keep one log file for each environment (Environments). The log files can be found in the /log directory under the root of your application.

How can I change the default behaviour?

See HowtoConfigureLogging for details.

See also