Project

General

Profile

Write log message from plugin

Added by Daniele Lupo almost 4 years ago

Hi.
I need to debug a plugin that's not working. Since I cannot debug it because it's on a remote production server, I'd like to add some log message that will be printed on production.log.

Since I'm new to ruby, what's the command that I must use in the plugin in order to write a log message?


Replies (2)

RE: Write log message from plugin - Added by Akiko Takano almost 4 years ago

Hi. You can log by just adding logger.info "your message" not only Redmine itself but also plugin's code.

Ref: https://www.redmine.org/projects/redmine/repository/entry/trunk/app/controllers/account_controller.rb#L279 (Redmine)

def your_method
  logger.info 'your message goes here'
  # or
  Rails.logger.info 'whatever'
end

RE: Write log message from plugin - Added by Daniele Lupo almost 4 years ago

Thanks, this is what I needed.

    (1-2/2)