View Issue Details

IDProjectCategoryView StatusLast Update
0025391mantisbtplug-inspublic2019-02-03 09:21
Reporterc2pil Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
Status newResolutionopen 
Product Version2.15.0 
Summary0025391: Write logs in a log file by plug-ins.
Description

I use Mantis with some plugins.

Currently, when my plugins logs events, they are in a single file (with current Mantis logs).

I would like to have one log file by plugins when I call the function "log_event".

Is it possible to add a function "log_event_plugins" for example, which will generate a log file by plugins ?

Steps To Reproduce

Configure Mantis to log in a file :

$g_log_destination = 'file:/PATHFILE'

TagsNo tags attached.

Activities

dregad

dregad

2019-01-29 04:36

developer   ~0061321

I don't really see the added value of a new feature to log plugin events to a separate file.

The logging API already records the plugin name in the log file, and you can call existing function plugin_log_event().

[date] PLUGIN [plugin_basename] [file_name]:[line_number] log message

If this is not sufficient for your purposes, then you can write a plugin that will hook into the EVENT_LOG event.

c2pil

c2pil

2019-01-29 09:41

reporter   ~0061325

Thanks for your answer.

I work with Mantis on a restricted network and where I do not have access to apache logs.

Some of our plugins do a lot of processing, which is why we need to have a log file per plugin (to debug ..).

In addition, is it possible to configure log rotation in Mantis?

Thanks again

dregad

dregad

2019-02-03 09:14

developer   ~0061376

I work with Mantis on a restricted network and where I do not have access to apache logs.

There is no need to have access to the apache logs. My point was that you can just use the mantisbt log with $g_log_level = LOG_PLUGIN;(available since 2.7.0), and pipe the log through grep to isolate only the entries you need for your plugin, e.g.

cat mantis.log |grep 'PluginName' |tail -20
dregad

dregad

2019-02-03 09:16

developer   ~0061377

In addition, is it possible to configure log rotation in Mantis?

Not from within Mantis, and this is not a feature we're planning to add. I suggest you use an OS-specific solution to achieve that, for example logrotate on linux.