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.
8133ee52ca72188132b5c7d97dfb967f?d=identicon&s=25 Chris Habgood (chabgood)
on 2009-02-07 20: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?
96146b7a23174e2e024c06a49f845bb8?d=identicon&s=25 Jeffrey L. Taylor (Guest)
on 2009-02-07 22:59
(Received via mailing list)
Quoting Me <chabgood@gmail.com>:
>
> 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
B11d21caa403bf6d46b0b29afa64ae70?d=identicon&s=25 willhaslett (Guest)
on 2009-02-08 06: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.