View Issue Details

IDProjectCategoryView StatusLast Update
0022053mantisbtplug-inspublic2017-10-08 23:52
Reportercproensa Assigned Tocproensa  
PrioritynormalSeverityfeatureReproducibilityhave not tried
Status closedResolutionfixed 
Product Version1.3.4 
Target Version2.7.0Fixed in Version2.7.0 
Summary0022053: Implement logging functionality for plugins

Plugins should have a standard way of log messages to mantis standard log.

Currently, logging_api provides log_event(), but this uses the standard defined log levels, eg: LOG_FILTERING, LOG_EMAIL, etc
These log levels are related to mntis core functions and may not be suitable for log information originated in a plugin.

The proposal is:

1) As a first step:

  • create a new log level LOG_PLUGIN
  • create plugin_api functions, eg: plugin_log_event(), that takes care of this log level, and formatting.
  • Format the log output including the plugin name that originated the message.

2) A second step:
At some point, we may want to allow configuring logging from a subset of plugins. With (1), enabiling LOG_PLUGIN means that all plugins logs will be written to mantis log.
An additional level of configuration may be needed to enable logging on a per-plugin basis.
Whether this is necessary, and how to do it is open to discussion)

TagsNo tags attached.


related to 0022035 assignedSL-Gundam Plugin - EmailReporting Format of logs for EMR job 




2016-12-19 05:47

developer   ~0054796

+1 for the first step.

Regarding 2), I think it would be worth considering in a wider refactoring of how we handle logging. Currently we have several log categories, that can be switched ON/OFF individually. IMO we should have a more detailed way of defining the log level (e.g. error, warning, info, debug...), following standard such as PSR-3 [1]

This would allow us to get rid of LOG_EMAIL "sub-categories" like LOG_EMAIL_RECIPIENT and LOG_EMAIL_VERBOSE for example.




2017-08-20 18:29

developer   ~0057517


Related Changesets

MantisBT: master 075369ab

2017-08-20 14:48:23


Committer: dregad Details Diff
Add logging functionality for plugins

- Create a new loglevel LOG_PLUGIN to write logs specifically from
- Add function plugin_log_event() to wrap the log call for plugins.

Fixes: 0022053
Affected Issues
mod - config_defaults_inc.php Diff File
mod - core/constant_inc.php Diff File
mod - core/logging_api.php Diff File
mod - core/plugin_api.php Diff File
mod - docbook/Admin_Guide/en-US/config/logging.xml Diff File