View Issue Details

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

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.

Relationships

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

Activities

dregad

dregad

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.

[1] http://www.php-fig.org/psr/psr-3/

cproensa

cproensa

2017-08-20 18:29

developer   ~0057517

PR https://github.com/mantisbt/mantisbt/pull/1161

Related Changesets

MantisBT: master 075369ab

2017-08-20 14:48:23

cproensa


Committer: dregad Details Diff
Add logging functionality for plugins

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

Fixes: 0022053
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

Issue History

Date Modified Username Field Change
2016-12-18 14:31 cproensa New Issue
2016-12-18 14:31 cproensa Relationship added related to 0022035
2016-12-19 05:47 dregad Note Added: 0054796
2017-08-20 18:29 cproensa Note Added: 0057517
2017-08-20 18:29 cproensa Assigned To => cproensa
2017-08-20 18:29 cproensa Status new => assigned
2017-10-07 12:32 dregad Changeset attached => MantisBT master 075369ab
2017-10-07 12:32 cproensa Status assigned => resolved
2017-10-07 12:32 cproensa Resolution open => fixed
2017-10-07 12:32 cproensa Fixed in Version => 2.7.0
2017-10-07 13:35 atrol Target Version => 2.7.0
2017-10-08 23:52 vboctor Status resolved => closed