Jepessen
Jepessen

Reputation: 12435

write redmine log from plugin

I need to debug a redmine plugin because It doesn't work and we don't know why.

I don't know how to debug ruby from a remote server (I don't know ruby), so I need to modify the source of the plugin in order to put some plugin output in redmine logs.

How can I write a message in redmine log from a plugin?

Upvotes: 0

Views: 672

Answers (1)

Holger Just
Holger Just

Reputation: 55888

Since Redmine is a Rails application, you can use all the log facilities of Rails in Redmine and your plugin. Specifically, there is a global logger which you can use to log messages to the logfile (e.g. log/production.log):

Rails.logger.info 'My logged message'

See https://guides.rubyonrails.org/debugging_rails_applications.html#the-logger for more details about the Rails logger.

Note that in a production environment, Redmine logs only messages of level info and above. When starting your server with RAILS_ENV=development, Redmine also logs debug messages by default.

Upvotes: 3

Related Questions