Project

General

Profile

Write log message from plugin

Added by chopper Khan about 3 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 Marat Aminov from RedmineUP almost 3 years ago

Ok, I will check it for you soon.

RE: Write log message from plugin - Added by Holger Just over 2 years ago

There is a global object available with Rails.logger which can be used to log messages. See https://guides.rubyonrails.org/debugging_rails_applications.html#sending-messages for a description on how to use this.

Note that in a production environment, the default log level is :info, meaning that only messages with a severity of info or above are actually logged (that specifically excluded messages logged at debug severity).

To log a simple message, you can thus write:

Rails.logger.info "Hello World" 
    (1-2/2)