Forum: Ruby on Rails Use rails logger in a class without active record

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Chris H. (Guest)
on 2009-02-07 21:25
(Received via mailing list)
How do I use the regular rails logger in a rails app in a class that
is does not inherit from active record?
Jeffrey L. Taylor (Guest)
on 2009-02-07 23:59
(Received via mailing list)
Quoting Me <removed_email_address@domain.invalid>:
>
> How do I use the regular rails logger in a rails app in a class that
> is does not inherit from active record?

RAILS_DEFAULT_LOGGER.debug "Debug message"

HTH,
  Jeffrey
willhaslett (Guest)
on 2009-02-08 07:02
(Received via mailing list)
Do you want to log from a controller?  If so, something like this in
application.rb is handy:

def log(message)
  logger.info "Any_prefix_you_want_to_grep: #{message.to_s}"
end

If you want to log from somewhere that's not inheriting any part of
the rails stack, I'll let someone else answer...
This topic is locked and can not be replied to.