Write log message from plugin
Added by chopper Khan about 1 year ago
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?
RE: Write log message from plugin - Added by Marat Aminov 10 months ago
Ok, I will check it for you soon.
RE: Write log message from plugin - Added by Holger Just 8 months 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"